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: Rajinder Yadav
Subject: Re: copying text into a paste buffer as you type?
Date: Thu, 16 Dec 2010 13:07:50 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

On 10-12-16 11:49 AM, Drew Adams wrote:
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.


Drew,

that works great, although I think you meant 'M-w' instead of 'M-x', thanks!

--
Kind Regards,
Rajinder Yadav



reply via email to

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