GNU bug report logs -
#50038
Permanent shift-select-mode
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Fri, 13 Aug 2021 07:15:01 UTC
Severity: normal
Tags: fixed
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50038 in the body.
You can then email your comments to 50038 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50038
; Package
emacs
.
(Fri, 13 Aug 2021 07:15:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 13 Aug 2021 07:15:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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":
[shift-select-mode-permanent.patch (text/x-diff, inline)]
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50038
; Package
emacs
.
(Fri, 13 Aug 2021 12:08:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 50038 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> So the following patch provides an option for the behavior that is more
> convenient than in "other apps":
Makes sense to me.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50038
; Package
emacs
.
(Sat, 14 Aug 2021 06:39:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 50038 <at> debbugs.gnu.org (full text, mbox):
> From: Juri Linkov <juri <at> linkov.net>
> Date: Fri, 13 Aug 2021 10:04:27 +0300
>
> 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":
Thanks.
> --- 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.
This is a negative description, which tells half of the story, and
leaves it to the reader to guess the other half (how to deactivate the
mark in this case). How about describing both, and in a positive way?
For example:
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.
And finally, a question: is it enough to have this as a user option?
That is, what if the user wants this only temporarily, for the next
sequence of commands that extend the region? Should we perhaps have a
better solution for that use case? More generally, perhaps this
feature is almost always wanted only for a sequence of commands, never
globally for extended periods of time? In that case, a user option is
not the best solution; it is better to have some minor mode that could
be turned on and off with a simple key sequence.
> 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)
This would also need a NEWS entry, if we eventually decide to do it
this way.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50038
; Package
emacs
.
(Sun, 15 Aug 2021 08:52:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 50038 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>> +When the value is `permanent', the mark will not be deactivated
>> +by any subsequent point motion key that was not shift-translated.
>
> This is a negative description, which tells half of the story, and
> leaves it to the reader to guess the other half (how to deactivate the
> mark in this case). How about describing both, and in a positive way?
> For example:
>
> 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.
Fixed in the new patch.
> And finally, a question: is it enough to have this as a user option?
> That is, what if the user wants this only temporarily, for the next
> sequence of commands that extend the region? Should we perhaps have a
> better solution for that use case? More generally, perhaps this
> feature is almost always wanted only for a sequence of commands, never
> globally for extended periods of time? In that case, a user option is
> not the best solution; it is better to have some minor mode that could
> be turned on and off with a simple key sequence.
It would be very surprising if someone might want something more complicated.
But everyone is welcome to extend this feature when such a need will arise.
>> 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)
>
> This would also need a NEWS entry, if we eventually decide to do it
> this way.
This patch also adds a NEWS entry:
[shift-select-mode-permanent-2.patch (text/x-diff, inline)]
diff --git a/etc/NEWS b/etc/NEWS
index 09ace73f5d..37acef0be1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
diff --git a/lisp/simple.el b/lisp/simple.el
index 985beb06fc..960422a6b2 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -6649,9 +6649,16 @@ 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 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 ()
@@ -6669,7 +6676,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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50038
; Package
emacs
.
(Sun, 15 Aug 2021 09:37:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 50038 <at> debbugs.gnu.org (full text, mbox):
> From: Juri Linkov <juri <at> linkov.net>
> Cc: 50038 <at> debbugs.gnu.org
> Date: Sun, 15 Aug 2021 11:37:48 +0300
>
> > And finally, a question: is it enough to have this as a user option?
> > That is, what if the user wants this only temporarily, for the next
> > sequence of commands that extend the region? Should we perhaps have a
> > better solution for that use case? More generally, perhaps this
> > feature is almost always wanted only for a sequence of commands, never
> > globally for extended periods of time? In that case, a user option is
> > not the best solution; it is better to have some minor mode that could
> > be turned on and off with a simple key sequence.
>
> It would be very surprising if someone might want something more complicated.
So you, for example, will use this value at all times?
> This patch also adds a NEWS entry:
Thanks, LGTM.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50038
; Package
emacs
.
(Sun, 15 Aug 2021 16:22:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 50038 <at> debbugs.gnu.org (full text, mbox):
tags 50038 fixed
close 50038 28.0.50
thanks
>> It would be very surprising if someone might want something more complicated.
>
> So you, for example, will use this value at all times?
Right, to me it makes sense not to deactivate the mark permanently
while typing non-shifted keys at all times.
>> This patch also adds a NEWS entry:
>
> Thanks, LGTM.
So now pushed to master.
Added tag(s) fixed.
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Sun, 15 Aug 2021 16:22:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 28.0.50, send any further explanations to
50038 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net>
Request was from
Juri Linkov <juri <at> linkov.net>
to
control <at> debbugs.gnu.org
.
(Sun, 15 Aug 2021 16:22:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 13 Sep 2021 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 278 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.