From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-15?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: yank-repeat-newline Date: Tue, 26 Jul 2011 21:12:35 +0200 Message-ID: <4E2F11A3.3090102@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1311707575 27341 80.91.229.12 (26 Jul 2011 19:12:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 26 Jul 2011 19:12:55 +0000 (UTC) To: "help-gnu-emacs@gnu.org List" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 26 21:12:51 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qln3j-0003pp-7N for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Jul 2011 21:12:51 +0200 Original-Received: from localhost ([::1]:46586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qln3d-00078q-FQ for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Jul 2011 15:12:45 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:43805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qln3Y-00078g-WD for help-gnu-emacs@gnu.org; Tue, 26 Jul 2011 15:12:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qln3X-0006Rk-TD for help-gnu-emacs@gnu.org; Tue, 26 Jul 2011 15:12:40 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.10]:57315) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qln3X-0006RX-GM for help-gnu-emacs@gnu.org; Tue, 26 Jul 2011 15:12:39 -0400 Original-Received: from [192.168.178.27] (brln-4dbc49d1.pool.mediaWays.net [77.188.73.209]) by mrelayeu.kundenserver.de (node=mreu1) with ESMTP (Nemesis) id 0MYrHb-1QyFf63wVX-00VfQz; Tue, 26 Jul 2011 21:12:36 +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 X-Provags-ID: V02:K0:Mm0eaG4yNU6XqKjIpO6ax6McwTq/NW+dCRcwX5qI6Z5 WvZKz5RtUMNQZbm263Z4qJJ1mpN+YI8vKq52baZ63lFuvrvPLx 3BoeqURUDUpm0wvs4S7G7hNhDWhIx8nMoXW/LtvVSUzS9iOSq1 L0B9sZxKVK/UaoIJjqyX8qL3ZWbHshj9VBfBl1WeP6SjOkM+Zb CYVCD/Sh3S1iaG4EII0OK30ty8pvChsgnuOrCqcPQA= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.17.10 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81790 Archived-At: 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/