emacs-devel
[Top][All Lists]
Advanced

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

Enhance word-based commands?


From: Kai Großjohann
Subject: Enhance word-based commands?
Date: Wed, 15 Jan 2003 20:16:03 +0100
User-agent: Gnus/5.090013 (Oort Gnus v0.13) Emacs/21.3.50 (i686-pc-linux-gnu)

I find that I like to use word-based commands to move words around in
the buffer.  So when faced with the task of moving some words from one
place to another, I'll intuitively try to use word-based motion to
position point (to spot A, say), then use word-based killing to delete
(well, kill) the phrase, then use word-based motion again to reach the
target spot (B, say), then use C-y to yank.

It turns out that this only works with some restrictions:

If you have reached spot A with M-f, then you must use M-d to kill
and again use M-f to reach spot B.  OTOH, if you have reached spot A
with M-b, then you must use M-DEL to kill and again use M-b to reach
the target spot.

Does this make sense?

The kill is wont to contain whitespace at one end, which causes the
problems.

I think it might help to change the behavior of the word-based
commands, as follows: Right now, M-f positions point after the end of
the next word.  If there are non-word characters at point, those are
skipped first.  I think it might help to change M-f as follows: if
there are non-word characters at point, skip past them but no
further.  The behavior of M-b would be the same: if at a non-word
character, skip past the chunk of non-word characters but no further.

With this change, it would be easy for me to get a kill which has
whitespace on neither end, thus leading to more predictable
behavior.  (The superfluous whitespace at the source location could
be fixed up with M-SPC or M-\, and missing whitespace could be added
to the target location in a similar way.)

What do people think?

It goes without saying that I'm not suggesting to change the default
behavior of Emacs, just to add a new behavior at user option.
-- 
Ambibibentists unite!





reply via email to

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