help-gnu-emacs
[Top][All Lists]
Advanced

[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 <address@hidden>,
 Thorsten Jolitz <address@hidden> wrote:

> Stefan Monnier <address@hidden> 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, address@hidden
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

[Prev in Thread] Current Thread [Next in Thread]