* copying text into a paste buffer as you type?
@ 2010-12-16 10:58 Rajinder Yadav
2010-12-16 16:49 ` Drew Adams
0 siblings, 1 reply; 7+ messages in thread
From: Rajinder Yadav @ 2010-12-16 10:58 UTC (permalink / raw)
To: emacs-help
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
Thanks!
--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely
GNU/Linux: 2.6.35-23-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: copying text into a paste buffer as you type?
[not found] <mailman.1.1292497153.3954.help-gnu-emacs@gnu.org>
@ 2010-12-16 11:27 ` LanX
0 siblings, 0 replies; 7+ messages in thread
From: LanX @ 2010-12-16 11:27 UTC (permalink / raw)
To: help-gnu-emacs
Hello Rajinder
On 16 Dez., 11:58, Rajinder Yadav <devguy...@gmail.com> 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
are you sure that's what you really want?
I think what you really want is snippet expansion. Have a look at
yasnippet, maybe starting with a youtube video.
IMHO it should be possible by using embedded elisp to keep the
variable parts of a line expansion into memory, and to use it as
default in the next line.
Another thing that came into my mind is (reimplementing?) bash's
behaviour for "M-." but "null => false" are multiple words.
Cheers
rolf
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: copying text into a paste buffer as you type?
2010-12-16 10:58 copying text into a paste buffer as you type? Rajinder Yadav
@ 2010-12-16 16:49 ` Drew Adams
2010-12-16 18:07 ` Rajinder Yadav
2010-12-20 7:09 ` Kevin Rodgers
0 siblings, 2 replies; 7+ messages in thread
From: Drew Adams @ 2010-12-16 16:49 UTC (permalink / raw)
To: 'Rajinder Yadav', 'emacs-help'
> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: copying text into a paste buffer as you type?
2010-12-16 16:49 ` Drew Adams
@ 2010-12-16 18:07 ` Rajinder Yadav
2010-12-16 18:30 ` Drew Adams
2010-12-20 7:09 ` Kevin Rodgers
1 sibling, 1 reply; 7+ messages in thread
From: Rajinder Yadav @ 2010-12-16 18:07 UTC (permalink / raw)
Cc: 'emacs-help' 10
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: copying text into a paste buffer as you type?
2010-12-16 18:07 ` Rajinder Yadav
@ 2010-12-16 18:30 ` Drew Adams
0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2010-12-16 18:30 UTC (permalink / raw)
To: 'Rajinder Yadav'; +Cc: ''emacs-help' 10'
> Drew, that works great, although I think you meant 'M-w'
> instead of 'M-x', thanks!
Yes, I did; good catch.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: copying text into a paste buffer as you type?
2010-12-16 16:49 ` Drew Adams
2010-12-16 18:07 ` Rajinder Yadav
@ 2010-12-20 7:09 ` Kevin Rodgers
2010-12-20 15:09 ` Drew Adams
1 sibling, 1 reply; 7+ messages in thread
From: Kevin Rodgers @ 2010-12-20 7:09 UTC (permalink / raw)
To: help-gnu-emacs
On 12/16/10 9: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.
C-SPC and M-w are keyboard commands pertaining to the region, not the selection.
So the 2 C-x C-x commands are not needed.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: copying text into a paste buffer as you type?
2010-12-20 7:09 ` Kevin Rodgers
@ 2010-12-20 15:09 ` Drew Adams
0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2010-12-20 15:09 UTC (permalink / raw)
To: 'Kevin Rodgers', help-gnu-emacs
> > C-SPC n u l l => f a l s e C-x C-x C-x C-x M-w
> C-SPC and M-w are keyboard commands pertaining to the region,
> not the selection. So the 2 C-x C-x commands are not needed.
Good point.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-12-20 15:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16 10:58 copying text into a paste buffer as you type? Rajinder Yadav
2010-12-16 16:49 ` Drew Adams
2010-12-16 18:07 ` Rajinder Yadav
2010-12-16 18:30 ` Drew Adams
2010-12-20 7:09 ` Kevin Rodgers
2010-12-20 15:09 ` Drew Adams
[not found] <mailman.1.1292497153.3954.help-gnu-emacs@gnu.org>
2010-12-16 11:27 ` LanX
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).