From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rajanikanth Jammalamadaka Newsgroups: gmane.emacs.help Subject: Re: copy and paste multiple times Date: Wed, 25 Jan 2012 12:37:52 -0500 Message-ID: References: <87zkdbu1mf.fsf@mithlond.arda> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d043c7bf621dc0404b75db999 X-Trace: dough.gmane.org 1327513098 17007 80.91.229.12 (25 Jan 2012 17:38:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 25 Jan 2012 17:38:18 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Teemu Likonen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 25 18:38:11 2012 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 1Rq6nS-0001Hi-NV for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Jan 2012 18:38:10 +0100 Original-Received: from localhost ([::1]:45304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rq6nS-00030c-3V for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Jan 2012 12:38:10 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52244) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rq6nI-0002zr-2m for help-gnu-emacs@gnu.org; Wed, 25 Jan 2012 12:38:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rq6nD-0003l7-5w for help-gnu-emacs@gnu.org; Wed, 25 Jan 2012 12:37:59 -0500 Original-Received: from mail-wi0-f169.google.com ([209.85.212.169]:34659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rq6nD-0003kl-0u for help-gnu-emacs@gnu.org; Wed, 25 Jan 2012 12:37:55 -0500 Original-Received: by wibhj13 with SMTP id hj13so915507wib.0 for ; Wed, 25 Jan 2012 09:37:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8MBmOapPBZ/yIikj1vSPLpkt5vu3L87UQKizY3TlFds=; b=AoVRVPX/9cJX+kiTv8+WJo7ea7geStx6ddkvUzUO6ES6VIVbd/EH+GVAzCkIBdL6EQ DWbj0d9MOFdsMYyZDY1KRg5wRbJjs3qOcAU06bK5iZndMOePUz1g/PgETPfc8qc2sd70 unSrjdRysnj62Dk5Go/wKvpUh5mBHrQ39iC8E= Original-Received: by 10.180.92.101 with SMTP id cl5mr29577476wib.21.1327513072687; Wed, 25 Jan 2012 09:37:52 -0800 (PST) Original-Received: by 10.180.97.229 with HTTP; Wed, 25 Jan 2012 09:37:52 -0800 (PST) In-Reply-To: <87zkdbu1mf.fsf@mithlond.arda> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.169 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:83557 Archived-At: --f46d043c7bf621dc0404b75db999 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Jan 25, 2012 at 12:35 PM, Teemu Likonen wrote: > * 2012-01-25T12:20:16-05:00 * Rajanikanth Jammalamadaka wrote: > > > This has been discussed below: > > http://stackoverflow.com/questions/71985/emacs-equivalent-of-vims-yy10p > > > > Is there no built-in (short :-)) command in emacs to copy and paste a > > region multiple times? > > The Stack Overflow question is about copying *lines*, not *a region* as > you put it. Which one do you mean? Anyway, there is no as quick command > as Vi's "yy10p". > > Possible solutions: > > 1. Write a desired command yourself. > 2. Switch to viper-mode for a moment. > 3. Delete line with C-k C-k and then yank it several times with C-y. > > My opinion is that yank command's numeric prefix argument should repeat > the yank. But Emacs is customizable and programmable, so I just do it: > > (global-set-key (kbd "C-y") (lambda (n) > (interactive "p") > (dotimes (i (abs n)) (yank)))) > Thanks for the replies and short functions. I meant copy and paste a region multiple times. Raj --f46d043c7bf621dc0404b75db999 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Wed, Jan 25, 2012 at 12:35 PM, Teemu = Likonen <tlikonen@i= ki.fi> wrote:
* 2012-01-25T12:20:16-05:00 * Rajan= ikanth Jammalamadaka wrote:

> This has been discussed below:
> http://stackoverflow.com/questions/71985/em= acs-equivalent-of-vims-yy10p
>
> Is there no built-in (short :-)) command in emacs to copy and paste a<= br> > region multiple times?

The Stack Overflow question is about copying *lines*, not *a re= gion* as
you put it. Which one do you mean? Anyway, there is no as quick command
as Vi's "yy10p".

Possible solutions:

=A01. Write a desired command yourself.
=A02. Switch to viper-mode for a moment.
=A03. Delete line with C-k C-k and then yank it several times with C-y.

My opinion is that yank command's numeric prefix argument should repeat=
the yank. But Emacs is customizable and programmable, so I just do it:

=A0 =A0(global-set-key (kbd "C-y") (lambda (n)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(intera= ctive "p")
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(dotime= s (i (abs n)) (yank))))

Thanks for the replies and short functions. I meant = copy and paste a region multiple times.

Raj --f46d043c7bf621dc0404b75db999--