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

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

Re: Undo: restore the region?


From: David Kastrup
Subject: Re: Undo: restore the region?
Date: Wed, 18 Jan 2006 17:46:34 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

David Reitter <david.reitter@gmail.com> writes:

>> > How can I get undo to restore the region along with the last
>> changes?
>> > I need this rather often in my workflow, and undo always removes the
>> > mark, which is very annoying.
>>
>> C-x C-x should reactivate it.
>
> Thanks, that's a good start. It works in some situations, but only
> for one step of Undo.
>
> Consider the following case:
>
> In the above sentence, select "good" as your region and enter "x".
> Then select "some" and press x again. Now do undo twice and press C-x
> C-x. I would expect "good" to be selected.
>
> I was going to bind my undo key to something like (lambda nil
> (interactive) (undo) (exchange-point-and-mark)) but obviously undo
> would have to work in several steps without selecting wrong text.

If you use transient-mark-mode (and it sounds like you do), that is an
exceptionally bad idea:

undo is an interactive compiled Lisp function in `simple.el'.
It is bound to C-_, <undo>, C-/, <menu-bar> <edit> <undo>.
(undo &optional ARG)

Undo some previous changes.
Repeat this command to undo more changes.
A numeric argument serves as a repeat count.

In Transient Mark mode when the mark is active, only undo changes within
the current region.  Similarly, when not in Transient Mark mode, just C-u
as an argument limits undo to changes within the current region.

[back]

As you can see, an active region is not something which you want to
have after an undo command, since then the next undo will only work
within that region.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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