summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2021-08-15 19:18:05 +0300
committerJuri Linkov <juri@linkov.net>2021-08-15 19:18:05 +0300
commit7ec057458135eed0dd08e2de4089e4814d71e440 (patch)
treeb85fc9336853a8e366ab46594f06f781996bfe7e /lisp
parent0da97a4ed9b0819fd9112f572a61724a66ba83a6 (diff)
downloademacs-7ec057458135eed0dd08e2de4089e4814d71e440.tar.gz
* lisp/simple.el (shift-select-mode): Add new choice 'permanent' (bug#50038).
(handle-shift-selection): Handle new choice 'permanent'.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/simple.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 1661346b375..7da315e8692 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -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