unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* backward-delete-word?
@ 2002-12-11 22:37 Timur Aydin
  2002-12-11 22:45 ` backward-delete-word? David Kastrup
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Timur Aydin @ 2002-12-11 22:37 UTC (permalink / raw)


Hi everybody,

I find myself quite often copying and then pasting something over an
existing string. Because I want to keep my hands on the keyboard, I
don't want to mark the string to be replaced with the mouse and the
paste the correct string. I just do a C-Backspace and then paste. But,
as you would guess, the C-Backspace gets rid of the data that I copied
and if I paste, the string that I want to replace is pasted back!

C-Backspace invokes backward-kill-word. I guess the problem is the
"kill", which saves the data in the kill ring. I probably need a
"backward-delete-word". Does this thing exist or does it have to be
written?

Emacs v21.2 on W2000.

--
Timur

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

* Re: backward-delete-word?
  2002-12-11 22:37 backward-delete-word? Timur Aydin
@ 2002-12-11 22:45 ` David Kastrup
  2002-12-11 22:50 ` backward-delete-word? Benjamin Lewis
  2002-12-11 23:01 ` backward-delete-word? Barry Margolin
  2 siblings, 0 replies; 12+ messages in thread
From: David Kastrup @ 2002-12-11 22:45 UTC (permalink / raw)


Timur Aydin <timuraydin@superonline.com> writes:

> I find myself quite often copying and then pasting something over an
> existing string. Because I want to keep my hands on the keyboard, I
> don't want to mark the string to be replaced with the mouse and the
> paste the correct string. I just do a C-Backspace and then paste. But,
> as you would guess, the C-Backspace gets rid of the data that I copied
> 

No it doesn't.  It just gets pushed one level deeper on the kill ring.

> and if I paste, the string that I want to replace is pasted back!

Well, then use M-y after your paste and it will try the next recent
kill for pasting.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: backward-delete-word?
  2002-12-11 22:37 backward-delete-word? Timur Aydin
  2002-12-11 22:45 ` backward-delete-word? David Kastrup
@ 2002-12-11 22:50 ` Benjamin Lewis
  2002-12-11 23:01 ` backward-delete-word? Barry Margolin
  2 siblings, 0 replies; 12+ messages in thread
From: Benjamin Lewis @ 2002-12-11 22:50 UTC (permalink / raw)


On 12 Dec 2002, Timur Aydin wrote:

> Hi everybody,
> 
> I find myself quite often copying and then pasting something over an
> existing string. Because I want to keep my hands on the keyboard, I
> don't want to mark the string to be replaced with the mouse and the
> paste the correct string. I just do a C-Backspace and then paste. But,
> as you would guess, the C-Backspace gets rid of the data that I copied
> and if I paste, the string that I want to replace is pasted back!
> 
> C-Backspace invokes backward-kill-word. I guess the problem is the
> "kill", which saves the data in the kill ring. I probably need a
> "backward-delete-word". Does this thing exist or does it have to be
> written?

This may not be the ideal solution for you, but note that C-Backspace does
not "get rid of" the data that you copied, it merely pushes something on
top of it in the kill ring.  When you do a yank (C-y), the word you deleted
will indeed be inserted, but if you then do a yank-pop (M-y), it will be
replaced by the text you want.

-- 
Benjamin Lewis

"Love is a snowmobile racing across the tundra and then suddenly it flips
 over, pinning you underneath.  At night, the ice weasels come."
--Matt Groening

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

* RE: backward-delete-word?
@ 2002-12-11 23:01 Bingham, Jay
  0 siblings, 0 replies; 12+ messages in thread
From: Bingham, Jay @ 2002-12-11 23:01 UTC (permalink / raw)


Timur,

Have you tried this:
C-Backspace C-y M-y

The yank-pop command (M-y) does this:
Replace just-yanked stretch of killed text with a different stretch.
This command is allowed only immediately after a `yank' or a `yank-pop'.
At such a time, the region contains a stretch of reinserted
previously-killed text.  `yank-pop' deletes that text and inserts in its
place a different stretch of killed text.

That description may be a little confusing because it doesent tell you
what different stretch of text is inserted.  Basically each time that
you hit M-y you get the previous entry in the kill ring.

-_
J_)
C_)ingham
.    HP - NonStop Austin Software & Services - Software Quality
Assurance
.    Austin, TX
. "Language is the apparel in which your thoughts parade in public.
.  Never clothe them in vulgar and shoddy attire."     -Dr. George W.
Crane-


-----Original Message-----
From: Timur Aydin [mailto:timuraydin@superonline.com] 
Sent: Wednesday, December 11, 2002 4:37 PM
To: help-gnu-emacs@gnu.org
Subject: backward-delete-word?

Hi everybody,

I find myself quite often copying and then pasting something over an
existing string. Because I want to keep my hands on the keyboard, I
don't want to mark the string to be replaced with the mouse and the
paste the correct string. I just do a C-Backspace and then paste. But,
as you would guess, the C-Backspace gets rid of the data that I copied
and if I paste, the string that I want to replace is pasted back!

C-Backspace invokes backward-kill-word. I guess the problem is the
"kill", which saves the data in the kill ring. I probably need a
"backward-delete-word". Does this thing exist or does it have to be
written?

Emacs v21.2 on W2000.

--
Timur
_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: backward-delete-word?
  2002-12-11 22:37 backward-delete-word? Timur Aydin
  2002-12-11 22:45 ` backward-delete-word? David Kastrup
  2002-12-11 22:50 ` backward-delete-word? Benjamin Lewis
@ 2002-12-11 23:01 ` Barry Margolin
  2002-12-12 14:24   ` backward-delete-word? Timur Aydin
  2 siblings, 1 reply; 12+ messages in thread
From: Barry Margolin @ 2002-12-11 23:01 UTC (permalink / raw)


In article <un0nckwrq.fsf@superonline.com>,
Timur Aydin  <timuraydin@superonline.com> wrote:
>Hi everybody,
>
>I find myself quite often copying and then pasting something over an
>existing string. Because I want to keep my hands on the keyboard, I
>don't want to mark the string to be replaced with the mouse and the
>paste the correct string. I just do a C-Backspace and then paste. But,
>as you would guess, the C-Backspace gets rid of the data that I copied
>and if I paste, the string that I want to replace is pasted back!

Now type M-y and the string you just pasted is replaced by the previous
item on the kill ring, which is the one you really wanted.

>C-Backspace invokes backward-kill-word. I guess the problem is the
>"kill", which saves the data in the kill ring. I probably need a
>"backward-delete-word". Does this thing exist or does it have to be
>written?

What I usually do is paste first, and then delete.  I position the cursor
at the beginning of the word and type C-y M-d.

-- 
Barry Margolin, barmar@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

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

* Re: backward-delete-word?
  2002-12-11 23:01 ` backward-delete-word? Barry Margolin
@ 2002-12-12 14:24   ` Timur Aydin
  2002-12-12 15:49     ` backward-delete-word? David Kastrup
  2002-12-12 15:55     ` backward-delete-word? Bernd Wolter
  0 siblings, 2 replies; 12+ messages in thread
From: Timur Aydin @ 2002-12-12 14:24 UTC (permalink / raw)


Barry Margolin <barmar@genuity.net> writes:

> In article <un0nckwrq.fsf@superonline.com>,
> 
> >C-Backspace invokes backward-kill-word. I guess the problem is the
> >"kill", which saves the data in the kill ring. I probably need a
> >"backward-delete-word". Does this thing exist or does it have to be
> >written?
> 
> What I usually do is paste first, and then delete.  I position the cursor
> at the beginning of the word and type C-y M-d.
> 

Yes, that works for one paste, but when I position to another string
that I want to paste over, the C-y now pastes the word that was
previously killed. Because the killed data goes to the kill-ring,
whenever I operate on a new word, I have to hit C-y M-y and the number
of M-y's is going to be one more than before. So, if I want to operate
on 4 strings, I will have to hit C-y M-y M-y M-y on the fourth
string...

--
Timur.

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

* RE: backward-delete-word?
@ 2002-12-12 15:28 Bingham, Jay
  0 siblings, 0 replies; 12+ messages in thread
From: Bingham, Jay @ 2002-12-12 15:28 UTC (permalink / raw)


Timur,

I feel your pain.
In similar circumstances I have stored text in a register and inserted
it into the buffer from the register.
Here are the register commands that I believe would interest you:
C-x r s <register-name> - copy region to register.
C-u C-x r s <register-name> - kill region to register.
C-x r a <register-name> - append copy of region to register.
C-u C-x r a <register-name> - kill region append to register.
C-x r i <register-name> - insert register contents into buffer.

Info describes registers as follows:
Each register has a name which is a single character.  A register can
store a piece of text, a rectangle, a position, a window configuration,
or a file name, but only one thing at any given time.  Whatever you
store in a register remains there until you store something else in that
register.  To see what a register R contains, use `M-x view-register'.

`M-x view-register <RET> R'

Single character means any character that you can enter from your
keyboard.  So A and a valid register names and specify two separate
registers, ~ is a valid register name, as is C-x.

Hope this helps,
-_
J_)
C_)ingham
.    HP - NonStop Austin Software & Services - Software Quality
Assurance
.    Office:  2122                  Phone:  8945
. "Language is the apparel in which your thoughts parade in public.
.  Never clothe them in vulgar and shoddy attire."       -Dr. George W.
Crane-


-----Original Message-----
From: Timur Aydin [mailto:tayd@bicom-inc.com] 
Sent: Thursday, December 12, 2002 8:24 AM
To: help-gnu-emacs@gnu.org
Subject: Re: backward-delete-word?

Barry Margolin <barmar@genuity.net> writes:

> In article <un0nckwrq.fsf@superonline.com>,
> 
> >C-Backspace invokes backward-kill-word. I guess the problem is the
> >"kill", which saves the data in the kill ring. I probably need a
> >"backward-delete-word". Does this thing exist or does it have to be
> >written?
> 
> What I usually do is paste first, and then delete.  I position the
cursor
> at the beginning of the word and type C-y M-d.
> 

Yes, that works for one paste, but when I position to another string
that I want to paste over, the C-y now pastes the word that was
previously killed. Because the killed data goes to the kill-ring,
whenever I operate on a new word, I have to hit C-y M-y and the number
of M-y's is going to be one more than before. So, if I want to operate
on 4 strings, I will have to hit C-y M-y M-y M-y on the fourth
string...

--
Timur.

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: backward-delete-word?
  2002-12-12 14:24   ` backward-delete-word? Timur Aydin
@ 2002-12-12 15:49     ` David Kastrup
  2002-12-12 15:55     ` backward-delete-word? Bernd Wolter
  1 sibling, 0 replies; 12+ messages in thread
From: David Kastrup @ 2002-12-12 15:49 UTC (permalink / raw)


Timur Aydin <tayd@bicom-inc.com> writes:

> Barry Margolin <barmar@genuity.net> writes:
> 
> > In article <un0nckwrq.fsf@superonline.com>,
> > 
> > >C-Backspace invokes backward-kill-word. I guess the problem is the
> > >"kill", which saves the data in the kill ring. I probably need a
> > >"backward-delete-word". Does this thing exist or does it have to be
> > >written?
> > 
> > What I usually do is paste first, and then delete.  I position the cursor
> > at the beginning of the word and type C-y M-d.
> > 
> 
> Yes, that works for one paste, but when I position to another string
> that I want to paste over, the C-y now pastes the word that was
> previously killed. Because the killed data goes to the kill-ring,
> whenever I operate on a new word, I have to hit C-y M-y and the number
> of M-y's is going to be one more than before. So, if I want to operate
> on 4 strings, I will have to hit C-y M-y M-y M-y on the fourth
> string...

Ok, so instead of C-y M-y just use M-2 C-y since that will also
rotate the kill ring so that after every deletion M-2 C-y again puts
the old kill back on top.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: backward-delete-word?
  2002-12-12 14:24   ` backward-delete-word? Timur Aydin
  2002-12-12 15:49     ` backward-delete-word? David Kastrup
@ 2002-12-12 15:55     ` Bernd Wolter
  1 sibling, 0 replies; 12+ messages in thread
From: Bernd Wolter @ 2002-12-12 15:55 UTC (permalink / raw)


Timur Aydin <tayd@bicom-inc.com> writes:


[...]

> 
> Yes, that works for one paste, but when I position to another string
> that I want to paste over, the C-y now pastes the word that was
> previously killed. Because the killed data goes to the kill-ring,
> whenever I operate on a new word, I have to hit C-y M-y and the number
> of M-y's is going to be one more than before. So, if I want to operate
> on 4 strings, I will have to hit C-y M-y M-y M-y on the fourth
> string...
> 
> --
> Timur.
> 
Why not use registers for that. Look up the documentation for "C-x rs"
and "C-x ri" or read about registers in the info file.

HTH

Bernd

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

* Re: backward-delete-word?
       [not found] <mailman.148.1039707361.19936.help-gnu-emacs@gnu.org>
@ 2002-12-13 22:34 ` Joe Fineman
  2002-12-13 23:02   ` backward-delete-word? Barry Margolin
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Fineman @ 2002-12-13 22:34 UTC (permalink / raw)


"Bingham, Jay" <Jay.Bingham@hp.com> writes:

> In similar circumstances I have stored text in a register and
> inserted it into the buffer from the register.

I too have often found registers a welcome relief from the
complexities of the kill ring.  However, there is one oddity about
their implementation that takes some getting used to.  When you insert
the contents of a register (C-x g), point is at the beginning of the
insertion; you have to do C-x C-x to get it to the end, where it would
be after yanking from the kill ring.  Either outcome could be argued
for, but it seems perverse to do these two very similar jobs in
different ways.
-- 
---  Joe Fineman    jcf@TheWorld.com

||:  You need two out of three: altitude, airspeed, and a brain.  :||

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

* Re: backward-delete-word?
  2002-12-13 22:34 ` backward-delete-word? Joe Fineman
@ 2002-12-13 23:02   ` Barry Margolin
  2002-12-13 23:58     ` backward-delete-word? Kevin Rodgers
  0 siblings, 1 reply; 12+ messages in thread
From: Barry Margolin @ 2002-12-13 23:02 UTC (permalink / raw)


In article <wkk7ida6q3.fsf@TheWorld.com>,
Joe Fineman  <jcf@TheWorld.com> wrote:
>"Bingham, Jay" <Jay.Bingham@hp.com> writes:
>
>> In similar circumstances I have stored text in a register and
>> inserted it into the buffer from the register.
>
>I too have often found registers a welcome relief from the
>complexities of the kill ring.  However, there is one oddity about
>their implementation that takes some getting used to.  When you insert
>the contents of a register (C-x g), point is at the beginning of the
>insertion; you have to do C-x C-x to get it to the end, where it would
>be after yanking from the kill ring.  Either outcome could be argued
>for, but it seems perverse to do these two very similar jobs in
>different ways.

I too have always found this curious.  My guess is that it's because
registers are most often used in keyboard macros (if you think of a macro
as a program, registers are the "variables"), while yanking is mainly
interactive, and the designer of the register code didn't think the same
expectations applied.  In any case, when creating a macro, it's easy to fix
up the location after inserting a register, and then you don't have to
worry about it.

-- 
Barry Margolin, barmar@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

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

* Re: backward-delete-word?
  2002-12-13 23:02   ` backward-delete-word? Barry Margolin
@ 2002-12-13 23:58     ` Kevin Rodgers
  0 siblings, 0 replies; 12+ messages in thread
From: Kevin Rodgers @ 2002-12-13 23:58 UTC (permalink / raw)


Barry Margolin wrote:

> In article <wkk7ida6q3.fsf@TheWorld.com>,
> Joe Fineman  <jcf@TheWorld.com> wrote:
> 
>>"Bingham, Jay" <Jay.Bingham@hp.com> writes:
>>
>>
>>>In similar circumstances I have stored text in a register and
>>>inserted it into the buffer from the register.
>>>
>>I too have often found registers a welcome relief from the
>>complexities of the kill ring.  However, there is one oddity about
>>their implementation that takes some getting used to.  When you insert
>>the contents of a register (C-x g), point is at the beginning of the
>>insertion; you have to do C-x C-x to get it to the end, where it would
>>be after yanking from the kill ring.  Either outcome could be argued
>>for, but it seems perverse to do these two very similar jobs in
>>different ways.
>>
> 
> I too have always found this curious.  My guess is that it's because
> registers are most often used in keyboard macros (if you think of a macro
> as a program, registers are the "variables"), while yanking is mainly
> interactive, and the designer of the register code didn't think the same
> expectations applied.  In any case, when creating a macro, it's easy to fix
> up the location after inserting a register, and then you don't have to
> worry about it.


C-x g runs the command insert-register-compatibility-binding:

Insert contents of register REGISTER.  (REGISTER is a character.)
Normally puts point before and mark after the inserted text.
If optional second arg is non-nil, puts mark before and point after.
Interactively, second arg is non-nil if prefix arg is supplied.


So: C-u C-x g

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

end of thread, other threads:[~2002-12-13 23:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.148.1039707361.19936.help-gnu-emacs@gnu.org>
2002-12-13 22:34 ` backward-delete-word? Joe Fineman
2002-12-13 23:02   ` backward-delete-word? Barry Margolin
2002-12-13 23:58     ` backward-delete-word? Kevin Rodgers
2002-12-12 15:28 backward-delete-word? Bingham, Jay
  -- strict thread matches above, loose matches on Subject: below --
2002-12-11 23:01 backward-delete-word? Bingham, Jay
2002-12-11 22:37 backward-delete-word? Timur Aydin
2002-12-11 22:45 ` backward-delete-word? David Kastrup
2002-12-11 22:50 ` backward-delete-word? Benjamin Lewis
2002-12-11 23:01 ` backward-delete-word? Barry Margolin
2002-12-12 14:24   ` backward-delete-word? Timur Aydin
2002-12-12 15:49     ` backward-delete-word? David Kastrup
2002-12-12 15:55     ` backward-delete-word? Bernd Wolter

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