unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Marcin Borkowski <mbork@mbork.pl>,
	Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: RE: [External] : What is the difference between (deactivate-mark) and (setq deactivate-mark t)?
Date: Sat, 3 Apr 2021 04:11:18 +0000	[thread overview]
Message-ID: <SA2PR10MB447445CB153C7781895F60DFF3799@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87pmzc825q.fsf@mbork.pl>

> Well, I understand what each of them does, but whay was the variable
> introduced and why would I want to  say `(setq deactivate-mark t)' in
> a command instead of just calling `(deactivate-mark)'?  I can't think of
> any possible reasons.  Any ideas?

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://www.gnu.org/software/emacs/manual/html_node/elisp/The-Mark.html



  reply	other threads:[~2021-04-03  4:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-03  3:42 What is the difference between (deactivate-mark) and (setq deactivate-mark t)? Marcin Borkowski
2021-04-03  4:11 ` Drew Adams [this message]
2021-04-03  4:13   ` [External] : " Drew Adams
2021-04-03  4:24     ` Drew Adams
2021-04-07  5:14   ` Marcin Borkowski
2021-04-07  7:25     ` tomas
2021-04-07 14:58       ` Drew Adams
2021-04-07 15:30         ` tomas
2021-04-07 14:54     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA2PR10MB447445CB153C7781895F60DFF3799@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=mbork@mbork.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).