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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : What is the difference between (deactivate-mark) and (s


From: Drew Adams
Subject: RE: [External] : What is the difference between (deactivate-mark) and (setq deactivate-mark t)?
Date: Sat, 3 Apr 2021 04:13:20 +0000

> I may be repeating what you say you already
> understand, but...
> 
> Function `deactivate-mark' deactivates the mark
> (duh), and it does so right away.
> 
> After a command finishes and returns, the command
> loop normally automatically deactivates the mark.
> IOW, for the next command the mark is inactive.
> 
> But if you set variable `deactivate-mark' to `nil'
> in your command then the command loop won't
> deactivate it when your command is done.
> 
> As the manual says:
> 
>   To write Lisp code that modifies the buffer
>   without causing deactivation of the mark at
>   the end of the command, bind 'deactivate-mark'
>   to 'nil' around the code that does the modification.
>   For example:
> 
>           (let (deactivate-mark)
>             (insert " "))
> 
> Setting the variable to nil says do NOT deactivate
> the mark.  See (elisp) `The Mark'.
> 
> https://urldefense.com/v3/__https://www.gnu.org/software/emacs/manual/html_no
> de/elisp/The-Mark.html__;!!GqivPVa7Brio!J-
> d7d78WD6nya8fCTTFpzUVHQ663J53lu6PUPuwSANdbP-lnuZeC2k3gEwHg1-Di$

I meant to add that you can do this in one command
when, for example, you want to keep the region active
for the next command.  E.g. when one command sets up
the region for other possible commands to use.




reply via email to

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