From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Madden Newsgroups: gmane.emacs.help Subject: Re: restore region after replace-string Date: Sun, 16 Jan 2011 19:38:36 -0700 Message-ID: <4D33ABAC.3000903@noaa.gov> References: <0dfdb0af-c0b4-446b-8d3d-d194b128d85f@u32g2000yqe.googlegroups.com> <4D33260E.5080901@noaa.gov> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7BIT X-Trace: dough.gmane.org 1295231947 30728 80.91.229.12 (17 Jan 2011 02:39:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 17 Jan 2011 02:39:07 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 17 03:39:01 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Peezk-0004LO-VC for geh-help-gnu-emacs@m.gmane.org; Mon, 17 Jan 2011 03:39:01 +0100 Original-Received: from localhost ([127.0.0.1]:43847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Peezk-0004WA-Af for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Jan 2011 21:39:00 -0500 Original-Received: from [140.186.70.92] (port=53372 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PeezQ-0004Vt-Iy for help-gnu-emacs@gnu.org; Sun, 16 Jan 2011 21:38:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PeezP-000843-Hs for help-gnu-emacs@gnu.org; Sun, 16 Jan 2011 21:38:40 -0500 Original-Received: from rome.boulder.noaa.gov ([140.172.10.146]:59308) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PeezP-00083w-AL for help-gnu-emacs@gnu.org; Sun, 16 Jan 2011 21:38:39 -0500 Original-Received: from [192.168.0.5] (c-98-245-119-87.hsd1.co.comcast.net [98.245.119.87]) by email.boulder.noaa.gov (iPlanet Messaging Server 5.2 HotFix 2.01 (built Aug 26 2004)) with ESMTPSA id <0LF500F0BBCDSO@email.boulder.noaa.gov> for help-gnu-emacs@gnu.org; Mon, 17 Jan 2011 02:38:38 +0000 (GMT) In-reply-to: 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 X-Enigmail-Version: 1.1.1 X-detected-operating-system: by eggs.gnu.org: Solaris 9 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor 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:78501 Archived-At: 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 > 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