unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Yanking multiple times
@ 2003-05-28 23:27 Balaji Venkataraman
  2003-05-28 23:55 ` François Fleuret
  2003-05-29  1:43 ` Benjamin Rutt
  0 siblings, 2 replies; 6+ messages in thread
From: Balaji Venkataraman @ 2003-05-28 23:27 UTC (permalink / raw)


How does one yank the same line multiple times?  e.g. - do a C-a, C-k and
then paste the same line 20 times (of course I don't want to hit C-y 20
times). I understand that a numeric argument to C-y, goes back into the 
kill-ring by that much, rather than repeat the command.

I tried info and google, but found nothing. 

Bala.
-- 
Remember 2 + 2 = 5, for large values of 2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Yanking multiple times
  2003-05-28 23:27 Yanking multiple times Balaji Venkataraman
@ 2003-05-28 23:55 ` François Fleuret
  2003-05-29  1:36   ` Balaji Venkataraman
  2003-05-29  1:43 ` Benjamin Rutt
  1 sibling, 1 reply; 6+ messages in thread
From: François Fleuret @ 2003-05-28 23:55 UTC (permalink / raw)


Good evening,

Balaji Venkataraman wrote on 29 May 2003 00:27:34 MET:

> How does one yank the same line multiple times?  e.g. - do a C-a,
> C-k and then paste the same line 20 times (of course I don't want to
> hit C-y 20 times). I understand that a numeric argument to C-y, goes
> back into the kill-ring by that much, rather than repeat the
> command.

C-u 2 0 C-y

should do it. More generally, many keys can be "repeted" several times
by using the "universal argument". This is especially usefull for
macros (C-x e).

Regards,

-- 
François Fleuret

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Yanking multiple times
  2003-05-28 23:55 ` François Fleuret
@ 2003-05-29  1:36   ` Balaji Venkataraman
  2003-05-29  8:11     ` François Fleuret
  0 siblings, 1 reply; 6+ messages in thread
From: Balaji Venkataraman @ 2003-05-29  1:36 UTC (permalink / raw)


On 29 May 2003 01:55:22 +0200, François Fleuret <francois.fleuret@inria.fr>
wrote: 

> Balaji Venkataraman wrote on 29 May 2003 00:27:34 MET:
>
>> How does one yank the same line multiple times?  e.g. - do a C-a, C-k and
>> then paste the same line 20 times (of course I don't want to hit C-y 20
>> times). I understand that a numeric argument to C-y, goes back into the
>> kill-ring by that much, rather than repeat the command.
>
> C-u 2 0 C-y

The line below is from info "C-h C-f kill-ring-save"

Any other sort of argument, including `C-u' and digits, specifies an
earlier kill to yank (*note Earlier Kills::).

> should do it. More generally, many keys can be "repeted" several times
> by using the "universal argument". This is especially usefull for
> macros (C-x e).

I'm aware of this. 
Thanks anyway!
-- 
Remember 2 + 2 = 5, for large values of 2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Yanking multiple times
  2003-05-28 23:27 Yanking multiple times Balaji Venkataraman
  2003-05-28 23:55 ` François Fleuret
@ 2003-05-29  1:43 ` Benjamin Rutt
  2003-05-31  1:09   ` Balaji Venkataraman
  1 sibling, 1 reply; 6+ messages in thread
From: Benjamin Rutt @ 2003-05-29  1:43 UTC (permalink / raw)


Balaji Venkataraman <bvenkata+nospam@sm.intel.com> writes:

> How does one yank the same line multiple times?  e.g. - do a C-a, C-k and
> then paste the same line 20 times (of course I don't want to hit C-y 20
> times). I understand that a numeric argument to C-y, goes back into the 
> kill-ring by that much, rather than repeat the command.

You can do it with a keyboard macro.  In CVS emacsen, you can do

F3 C-y F4

Then, pressing F4 will repeat the C-y.  You can do C-u 20 F4 to repeat
the keyboard macro 20 times.

The same is true in older emacsen with older, still-supported
keybindings, via

C-x ( C-y C-x ) 

followed by

C-u 20 C-x e
-- 
Benjamin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Yanking multiple times
  2003-05-29  1:36   ` Balaji Venkataraman
@ 2003-05-29  8:11     ` François Fleuret
  0 siblings, 0 replies; 6+ messages in thread
From: François Fleuret @ 2003-05-29  8:11 UTC (permalink / raw)


Hi,

> Any other sort of argument, including `C-u' and digits, specifies an
> earlier kill to yank (*note Earlier Kills::).

Oups. Shame on me.

,----
| (defun multiple-yank (&optional n) (interactive "p")
|   (while (> n 0)
|     (setq n (1- n))
|     (yank)))
| 
| (define-key global-map [(control insert)] 'multiple-yank)
`----

Should make <C-insert> do the trick ?

Regards,

-- 
François Fleuret

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Yanking multiple times
  2003-05-29  1:43 ` Benjamin Rutt
@ 2003-05-31  1:09   ` Balaji Venkataraman
  0 siblings, 0 replies; 6+ messages in thread
From: Balaji Venkataraman @ 2003-05-31  1:09 UTC (permalink / raw)


On Wed, 28 May 2003 21:43:47 -0400, Benjamin Rutt
<rutt+news@cis.ohio-state.edu> wrote: 

> Balaji Venkataraman <bvenkata+nospam@sm.intel.com> writes:
>
>> How does one yank the same line multiple times?  e.g. - do a C-a, C-k and
>> then paste the same line 20 times (of course I don't want to hit C-y 20
>> times). I understand that a numeric argument to C-y, goes back into the
>> kill-ring by that much, rather than repeat the command.
>
> You can do it with a keyboard macro.  In CVS emacsen, you can do

I usually have viper-mode on. It does help in a situation like
this. Strangely enough, I'd never thought about this problem earlier - can't
believe it's not one of the simpler things to do in emacs.

Thanks anyway!
-- 
Remember 2 + 2 = 5, for large values of 2

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-05-31  1:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-28 23:27 Yanking multiple times Balaji Venkataraman
2003-05-28 23:55 ` François Fleuret
2003-05-29  1:36   ` Balaji Venkataraman
2003-05-29  8:11     ` François Fleuret
2003-05-29  1:43 ` Benjamin Rutt
2003-05-31  1:09   ` Balaji Venkataraman

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).