unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50038: Permanent shift-select-mode
@ 2021-08-13  7:04 Juri Linkov
  2021-08-13 12:06 ` Lars Ingebrigtsen
  2021-08-14  6:37 ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Juri Linkov @ 2021-08-13  7:04 UTC (permalink / raw)
  To: 50038

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

It's very convenient to use a shift-translated key to activate the region,
because e.g. 'S-C-f' requires typing less keys than 'C-SPC C-f'.

But when there is a need to extend the region by typing a navigation key
that is not shift-translated, it abruptly deactivates the region.
The current default behavior was implemented in such unusable way
because "other apps" behave the same way.

So the following patch provides an option for the behavior that is more
convenient than in "other apps":


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: shift-select-mode-permanent.patch --]
[-- Type: text/x-diff, Size: 1393 bytes --]

diff --git a/lisp/simple.el b/lisp/simple.el
index 25a5a166e8..d951570937 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -6649,9 +6649,15 @@ shift-select-mode
 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 not be deactivated
+by any subsequent point motion key that was 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 ()
@@ -6669,7 +6675,12 @@ handle-shift-selection
 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

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

end of thread, other threads:[~2021-08-15 16:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13  7:04 bug#50038: Permanent shift-select-mode Juri Linkov
2021-08-13 12:06 ` Lars Ingebrigtsen
2021-08-14  6:37 ` Eli Zaretskii
2021-08-15  8:37   ` Juri Linkov
2021-08-15  9:36     ` Eli Zaretskii
2021-08-15 16:19       ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).