From: Yuri Khan <yurivkhan@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Mark set by ‘mark-*’ not deactivated by point motion
Date: Tue, 18 Sep 2018 00:25:31 +0700 [thread overview]
Message-ID: <CAP_d_8UkDzKc5o5mW1v4tJxwsE336q53eCTejQ3yqM9XX1Wx0g@mail.gmail.com> (raw)
Hello,
the raging discussion about the region models in emacs-devel reminded
me of an annoyance that I never took the time to report.
$ emacs -Q
M-x emacs-version
→ GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
of 2018-05-29
M-: transient-mark-mode
→ t
M-: shift-select-mode
→ t
1. Move point before the word “buffer” in the first line in *scratch*.
2. Press M-@ for ‘mark-word’. Observe that the mark is set after the
word ”buffer” and activated.
3. Move point with an unshifted point motion key.
Observed behavior: point moves as commanded, mark remains active.
Expected behavior: point moves, mark is deactivated.
Carefully looking at the docstring of shift-select-mode and the
implementation code in simple.el, I see that unshifted point motion
keys only deactivate mark if it was activated by shift-selection, but
it runs against my general expectation that selection goes away after
any motion that is not specifically directed to extend/shrink
selection. The only exception I’d make is C-SPC ‘set-mark-command’
because I see that as an explicit command to start marking an active
region without holding down Shift (e.g. as a workaround for terminals
that do not report Shift+arrows to the application).
Pre-emptive counterarguments:
“You could use Ctrl+Shift+<right> to mark a word in a way that will be
deactivate on motion.” — Yes, but the issue also affects mark-sexp,
mark-end-of-sentence, mark-paragraph, mark-defun, and mark-page, and
not all of these have shift-translatable motion equivalent. (E.g.
forward-paragraph is on M-} which is already shifted, and forward-page
is on C-x ] whose shifted version, C-x }, is bound to
enlarge-window-horizontally.)
“You could advise mark-* so that they set transient-mark-mode the same
way as shift-selection does.” — Why yes, I could. Thanks.
(defun yk-mark-*:after (&rest _args)
(setq-local transient-mark-mode (cons 'only transient-mark-mode)))
(advice-add 'mark-word :after 'yk-mark-*:after)
(advice-add 'mark-sexp :after 'yk-mark-*:after)
…
(advice-add 'mark-whole-buffer :after 'yk-mark-*:after)
next reply other threads:[~2018-09-17 17:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-17 17:25 Yuri Khan [this message]
2018-09-17 18:25 ` Mark set by ‘mark-*’ not deactivated by point motion Eli Zaretskii
2018-09-17 19:18 ` Stefan Monnier
2018-09-17 19:39 ` Mark set by ?mark-*? " Drew Adams
2018-09-18 6:24 ` Mark set by ‘mark-*’ " Yuri Khan
[not found] ` <mailman.897.1537213211.1284.help-gnu-emacs@gnu.org>
2018-09-18 8:45 ` Mark set by ?mark-*? " Loris Bennett
2018-09-18 11:45 ` Eli Zaretskii
[not found] ` <mailman.918.1537271124.1284.help-gnu-emacs@gnu.org>
2018-09-19 6:33 ` Loris Bennett
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=CAP_d_8UkDzKc5o5mW1v4tJxwsE336q53eCTejQ3yqM9XX1Wx0g@mail.gmail.com \
--to=yurivkhan@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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).