[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proper use of `deactivate-mark'?
From: |
Barry Margolin |
Subject: |
Re: Proper use of `deactivate-mark'? |
Date: |
Thu, 13 Feb 2014 13:07:59 -0500 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <mailman.14992.1392314356.10748.help-gnu-emacs@gnu.org>,
Thorsten Jolitz <tjolitz@gmail.com> wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> 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 ***