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: Thorsten Jolitz
Subject: Re: Proper use of `deactivate-mark'?
Date: Thu, 13 Feb 2014 18:59:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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)
  `---------------------------------------------------------

-- 
cheers,
Thorsten




reply via email to

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