From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: Proper use of `deactivate-mark'? Date: Thu, 13 Feb 2014 13:07:59 -0500 Organization: A noiseless patient Spider Message-ID: References: <871tz7x75c.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1392315010 6559 80.91.229.3 (13 Feb 2014 18:10:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Feb 2014 18:10:10 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 13 19:10:19 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WE0jq-0004EV-Hs for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Feb 2014 19:10:18 +0100 Original-Received: from localhost ([::1]:48208 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE0jq-0003eA-30 for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Feb 2014 13:10:18 -0500 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!barmar.motzarella.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 48 Injection-Info: barmar.motzarella.org; posting-host="2be9e9f5dd9af768b8861af71b85fc28"; logging-data="8289"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wUNHYC7oaei9G2tZ2XGBq" User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Cancel-Lock: sha1:qWSCortCoqXNNNvWxmQtI0uW9mI= Original-Xref: usenet.stanford.edu gnu.emacs.help:203793 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96063 Archived-At: In article , Thorsten Jolitz wrote: > Stefan Monnier writes: > > >> Isn't that the appropriate use of `deactivate-mark'? > > > > Sounds right, yes. > > > >> How can I make sure that no mark is active anymore when I'm done in > >> buffer B and switch back to buffer A? > > > > Not sure why the mark is re-activated. Could be because you call > > deactivate-mark from with a save-excursion. > > Not really, but I found the culprit: > > Inside the (and ...) deactivate-mark does not do its work properly (does > copy-to-register return nil?) > > ,------------------------------------------------------- > | (and > | (use-region-p) > | (copy-to-register ?s (region-beginning) (region-end)) > | (deactivate-mark) ) > `------------------------------------------------------- > > but refactored like this the mark is actually deactivated: > > ,--------------------------------------------------------- > | (and > | (use-region-p) > | (copy-to-register ?s (region-beginning) (region-end)) ) > | (deactivate-mark) > `--------------------------------------------------------- Maybe it should be: (and (use-region-p) (progn (copy-to-register ?s (region-beginning) (region0end)) (deactivate-mark))) -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***