From: Eli Zaretskii <eliz@gnu.org>
To: Markus Triska <triska@metalevel.at>
Cc: 35177@debbugs.gnu.org
Subject: bug#35177: 27.0.50; Binding deactivate-mark to nil unexpectedly deactivates the mark
Date: Sun, 07 Apr 2019 18:42:40 +0300 [thread overview]
Message-ID: <831s2dakjz.fsf@gnu.org> (raw)
In-Reply-To: <m2tvfa3ca1.fsf@metalevel.at> (message from Markus Triska on Sun, 07 Apr 2019 02:11:02 +0200)
> From: Markus Triska <triska@metalevel.at>
> Date: Sun, 07 Apr 2019 02:11:02 +0200
>
> Please start Emacs with "emacs -Q" and insert the following form in the
> *scratch* buffer:
>
> (progn
> (let (deactivate-mark)
> (switch-to-buffer (get-buffer-create "t"))
> (erase-buffer)
> (insert "hello"))
> (let (deactivate-mark)
> (set-mark-command nil)
> (move-beginning-of-line nil)))
>
> then place point at the end of the form and evaluate it with C-x C-e.
>
> You will see a new buffer ("t"), where "hello" is inserted and nothing
> is highlighted because the mark is inactive.
>
> However, I expect the mark to be active and the region highlighted,
> because the form binds deactivate-mark to nil. This is the way that is
> recommended in the Elisp manual, see for Example 31.7 "The Mark":
>
> 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 " "))
>
I think you need to put the entire progn inside the binding of
deactivate-mark. IOW, the binding should be in effect when the
command terminates.
next prev parent reply other threads:[~2019-04-07 15:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-07 0:11 bug#35177: 27.0.50; Binding deactivate-mark to nil unexpectedly deactivates the mark Markus Triska
2019-04-07 15:42 ` Eli Zaretskii [this message]
2019-04-07 22:39 ` Markus Triska
2019-04-08 2:35 ` Eli Zaretskii
2019-04-08 10:03 ` Markus Triska
2019-04-08 15:09 ` Eli Zaretskii
2019-04-08 15:50 ` Markus Triska
2019-04-08 16:00 ` Eli Zaretskii
2019-04-09 0:04 ` Noam Postavsky
2019-04-09 15:26 ` Markus Triska
2019-04-09 23:46 ` Noam Postavsky
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=831s2dakjz.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=35177@debbugs.gnu.org \
--cc=triska@metalevel.at \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.