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: Andreas Röhler
Subject: Re: elisp how to insert text at end of each line
Date: Thu, 11 Apr 2013 12:50:33 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130307 Thunderbird/17.0.4

Am 11.04.2013 12:23, schrieb acomber:
That works, thanks.  I implemented as a function which inserted literal text.

But I like the idea of being able to pass parameters to the function.  so I
tried this:

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

But then in emacs how do I pass the text parameter?

I keep getting:

call-interactively: Wrong number of arguments: (lambda (text) "convert word
tbl to html tbl" (interactive) (goto-char (point-min)) (while (not (eobp))
(end-of-line) (insert text) (next-line))), 0

Do I have to specify somewhere that function takes parameters???



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



that's probably not the best way to do it, just to play on,
fill the text at the (invisible) prompt in the minibuffer

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

BTW use forward-line in programs, as next-line is designed for interactive use.



reply via email to

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