help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: elisp how to insert text at end of each line


From: acomber
Subject: Re: elisp how to insert text at end of each line
Date: Thu, 11 Apr 2013 07:02:58 -0700 (PDT)

Don't know if its useful but as a result of learning from this forum, I
implemented like this:

(defun do-cols (text) 
  (goto-char (point-min)) 
     (while (search-forward "\t" nil t)
        (replace-match text)
     )
)

(defun do-rows (text) 
  "convert word tbl to html tbl"
  (interactive)
  (goto-char (point-min)) 
  (while (not (eobp)) 
    (end-of-line) 
    (insert text) 
    (forward-line)
  )
)

(defun do-table ()
  "convert word tbl to html tbl"
  (interactive)
  (goto-char (point-min))
  (insert "
")
  (insert "
")
  (insert "     ")  
  (do-cols "    ") 
  (do-rows "
")
  (insert "")
  (insert "")
  (insert "
")   
)

It’s probably the naffest lisp function ever, but it works for me.

It requires the only text in the buffer to be the table data and only works
on a single table.



--
View this message in context: 
http://emacs.1067599.n5.nabble.com/elisp-how-to-insert-text-at-end-of-each-line-tp283410p283483.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]