help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: copying text into a paste buffer as you type?


From: Drew Adams
Subject: RE: copying text into a paste buffer as you type?
Date: Thu, 16 Dec 2010 08:49:26 -0800

> is there a way to get emacs to copy text into a paste buffer as you 
> type? for example, I would like to type 'null => false' once 
> and be able to paste into the other lines
> 
>    t.string :title, null => false
>    t.string :name, null => false
>    t.text :post, null => false

Yes, but you have to tell it when to start and stop copying. 

 C-SPC  n u l l  = >  f a l s e  C-x C-x  C-x C-x  M-w

 Start:
  `C-SPC'    Mark selection beginning.
 Type text.
 Stop:
  `C-x C-x'  Activate selection, swapping mark and point.
  `C-x C-x'  Swap mark and point back again.
  `M-x'      Copy selection to kill-ring (paste buffer).

Then `C-y' to yank (paste) it.

---

If you want to paste the same text multiple times but still be able to select
other text without interfering with what you saved (copied), use the secondary
selection: To select and copy for the secondary selection: drag `mouse-1' with
the Meta key depressed.  To yank it: `M-mouse-2'.

This is particularly useful for replacing selected text here and there (esp. in
delete-selection mode).  E.g., double-click `mouse-1' on a sexp to select it,
then `M-mouse-2' to replace it.  So instead of using `query-replace' you can use
it to change selected occurrences of `null => false' to `hopalong cassidy'.

http://www.emacswiki.org/emacs/SecondarySelection

An alternative to using the secondary selection is to use `M-y', perhaps
multiple times, just after you yank (`C-y').  That cycles through previous
kill-ring entries until you get to the one you want.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]