* lisp/simple.el (shift-select-mode): Add new choice 'permanent' (bug#50038).

(handle-shift-selection): Handle new choice 'permanent'.
This commit is contained in:
Juri Linkov 2021-08-15 19:18:05 +03:00
parent 0da97a4ed9
commit 7ec0574581
2 changed files with 20 additions and 2 deletions

View file

@ -263,6 +263,12 @@ This works in text buffers and over images. Typing a numeric prefix arg
(e.g. 'M-5') before starting horizontal scrolling changes its step value.
The value is saved in the user option 'mouse-wheel-scroll-amount-horizontal'.
---
** New choice 'permanent' for 'shift-select-mode'.
When the mark was activated by shifted motion keys,
non-shifted motion keys don't deactivate the mark
after customizing 'shift-select-mode' to 'permanent'.
---
** The default value of 'frame-title-format' and 'icon-title-format' has changed.
These variables are used to display the title bar of visible frames

View file

@ -6660,9 +6660,16 @@ is temporarily turned on. Furthermore, the mark will be deactivated
by any subsequent point motion key that was not shift-translated, or
by any action that normally deactivates the mark in Transient Mark mode.
When the value is `permanent', the mark will be deactivated by any
action which normally does that, but not by motion keys that were
not shift-translated.
See `this-command-keys-shift-translated' for the meaning of
shift-translation."
:type 'boolean
:type '(choice (const :tag "Off" nil)
(const :tag "Permanent" permanent)
(other :tag "On" t))
:version "28.1"
:group 'editing-basics)
(defun handle-shift-selection ()
@ -6680,7 +6687,12 @@ translation.
Otherwise, if the region has been activated temporarily,
deactivate it, and restore the variable `transient-mark-mode' to
its earlier value."
(cond ((and shift-select-mode this-command-keys-shift-translated)
(cond ((and (eq shift-select-mode 'permanent)
this-command-keys-shift-translated)
(unless mark-active
(push-mark nil nil t)))
((and shift-select-mode
this-command-keys-shift-translated)
(unless (and mark-active
(eq (car-safe transient-mark-mode) 'only))
(setq-local transient-mark-mode