all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Mark set by ‘mark-*’ not deactivated by point motion
@ 2018-09-17 17:25 Yuri Khan
  2018-09-17 18:25 ` Eli Zaretskii
  2018-09-17 19:18 ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Yuri Khan @ 2018-09-17 17:25 UTC (permalink / raw)
  To: help-gnu-emacs

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)



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-09-19  6:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-17 17:25 Mark set by ‘mark-*’ not deactivated by point motion Yuri Khan
2018-09-17 18:25 ` 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

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.