From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: Undo: restore the region? Date: Wed, 18 Jan 2006 17:46:34 +0100 Organization: Organization?!? Message-ID: <85zmltiivp.fsf@lola.goethe.zz> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1137614636 17753 80.91.229.2 (18 Jan 2006 20:03:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 18 Jan 2006 20:03:56 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 18 21:03:44 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EzJWD-0003hD-Ex for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Jan 2006 21:02:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EzJYc-0001YG-4L for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Jan 2006 15:05:26 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.gamma.ru!Gamma.RU!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:4eAW5eHVW8xoZuGpS1YXqzEy3Fg= Original-Lines: 45 Original-NNTP-Posting-Date: 18 Jan 2006 17:46:32 MET Original-NNTP-Posting-Host: 3e93c552.newsread4.arcor-online.net Original-X-Trace: DXC=Oa=i]bQV@]1_78OXD477\?:ejgIfPPld4jW\KbG]kaM8A@_25la3nb2I5Lo7AA=b591_LiI6ENVa=3>5MOK` List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:32724 Archived-At: David Reitter 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-_, , C-/, . (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