unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Undo: restore the region?
@ 2006-01-17 15:03 David Reitter
  0 siblings, 0 replies; 5+ messages in thread
From: David Reitter @ 2006-01-17 15:03 UTC (permalink / raw)


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.

Thanks in advance for your help!

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

* Re: Undo: restore the region?
       [not found] <mailman.1453.1137511569.26925.help-gnu-emacs@gnu.org>
@ 2006-01-17 15:53 ` David Kastrup
  0 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2006-01-17 15:53 UTC (permalink / raw)


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.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: Undo: restore the region?
@ 2006-01-18 16:00 David Reitter
  0 siblings, 0 replies; 5+ messages in thread
From: David Reitter @ 2006-01-18 16:00 UTC (permalink / raw)


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

- D

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

* Re: Undo: restore the region?
       [not found] <mailman.1615.1137600200.26925.help-gnu-emacs@gnu.org>
@ 2006-01-18 16:46 ` David Kastrup
  0 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2006-01-18 16:46 UTC (permalink / raw)


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

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

* Re: Undo: restore the region?
@ 2006-01-19 17:51 David Reitter
  0 siblings, 0 replies; 5+ messages in thread
From: David Reitter @ 2006-01-19 17:51 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 561 bytes --]

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

Yes, that makes sense.
I was briefly considering hacking this to produce an Undo function  
which ignores any region setting even in transient mark mode. The  
secondary selection could, in that case, serve to mark a region to  
apply Undo to.

But all of this only makes sense if I can get Undo to always restore  
the region.

- D


[-- Attachment #1.2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2400 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

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

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

end of thread, other threads:[~2006-01-19 17:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1453.1137511569.26925.help-gnu-emacs@gnu.org>
2006-01-17 15:53 ` Undo: restore the region? David Kastrup
2006-01-19 17:51 David Reitter
     [not found] <mailman.1615.1137600200.26925.help-gnu-emacs@gnu.org>
2006-01-18 16:46 ` David Kastrup
  -- strict thread matches above, loose matches on Subject: below --
2006-01-18 16:00 David Reitter
2006-01-17 15:03 David Reitter

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