[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: restore region after replace-string
From: |
Paul Madden |
Subject: |
Re: restore region after replace-string |
Date: |
Sun, 16 Jan 2011 19:38:36 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 |
You're right -- that's even better. Thanks again.
paul
On 01/16/2011 07:22 PM, Le Wang wrote:
> On Mon, Jan 17, 2011 at 1:08 AM, Paul Madden <Paul.A.Madden@noaa.gov
> <mailto:Paul.A.Madden@noaa.gov>> wrote:
>
> (defun rs ()
> (interactive)
> (let (deactivate-mark)
> (save-excursion (call interactively 'replace-string)))
> (exchange-point-and-mark)
> (exchange-point-and-mark))
>
>
> You don't need the exchange-point-and-mark calls. As a part of the Emacs
> commandloop, deactivate-mark is checked after executing your command, `rs'.
> As
> long as you prevent your buffer modification code from setting
> `deactivate-mark'
> to not-nil, the region should be active.
>
> --
> Le