[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
yank-repeat-newline
From: |
Andreas Röhler |
Subject: |
yank-repeat-newline |
Date: |
Tue, 26 Jul 2011 21:12:35 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11 |
Hi,
there was a thread "repeating yank" on this list, which resulted here in
two functions:
(defun yank-repeat (arg)
"With numerical ARG, repeat last yank ARG times. "
(interactive "p*")
(dotimes (i arg)
(insert (car kill-ring))))
(defun yank-repeat-newline (arg)
"With numerical ARG, repeat last yank ARG times,
also insert a newline. "
(interactive "p*")
(dotimes (i arg)
(insert (concat (car kill-ring) "\n"))))
Now when trying to combine both, get difficulties
;; not working now
(defun yank-repeat-newline (arg &optional nl)
"With numerical ARG, repeat last yank ARG times.
With optional arg NL, also insert newlines. "
(interactive "p\nP*")
(let ((nl nl)
(num arg))
(dotimes (i num)
(if nl
(insert (concat (car kill-ring) "\n"))
(insert (car kill-ring))))))
What is the recommended way writing that?
Thanks,
Andreas
--
https://launchpad.net/python-mode
https://launchpad.net/s-x-emacs-werkstatt/
- yank-repeat-newline,
Andreas Röhler <=
RE: yank-repeat-newline, Drew Adams, 2011/07/26