From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: "help-gnu-emacs@gnu.org List" <help-gnu-emacs@gnu.org>
Subject: yank-repeat-newline
Date: Tue, 26 Jul 2011 21:12:35 +0200 [thread overview]
Message-ID: <4E2F11A3.3090102@easy-emacs.de> (raw)
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/
next reply other threads:[~2011-07-26 19:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-26 19:12 Andreas Röhler [this message]
2011-07-26 19:19 ` yank-repeat-newline Teemu Likonen
2011-07-26 19:24 ` yank-repeat-newline Andreas Röhler
2011-07-26 19:35 ` yank-repeat-newline Teemu Likonen
2011-07-26 19:45 ` yank-repeat-newline Andreas Röhler
2011-07-26 20:33 ` yank-repeat-newline Drew Adams
2011-07-26 19:32 ` yank-repeat-newline Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E2F11A3.3090102@easy-emacs.de \
--to=andreas.roehler@easy-emacs.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).