From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#50038: Permanent shift-select-mode Date: Sun, 15 Aug 2021 11:37:48 +0300 Organization: LINKOV.NET Message-ID: <874kbrciwz.fsf@mail.linkov.net> References: <87czqif4y5.fsf@mail.linkov.net> <83lf54bkft.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10262"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 50038@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 15 10:52:20 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mFBsQ-0002OC-OZ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 Aug 2021 10:52:18 +0200 Original-Received: from localhost ([::1]:60772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFBsK-0008VY-Py for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 Aug 2021 04:52:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFBsB-0008Us-VN for bug-gnu-emacs@gnu.org; Sun, 15 Aug 2021 04:52:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34199) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mFBsB-0005XD-On for bug-gnu-emacs@gnu.org; Sun, 15 Aug 2021 04:52:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mFBsA-0005Tr-NH for bug-gnu-emacs@gnu.org; Sun, 15 Aug 2021 04:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Aug 2021 08:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50038 X-GNU-PR-Package: emacs Original-Received: via spool by 50038-submit@debbugs.gnu.org id=B50038.162901746220960 (code B ref 50038); Sun, 15 Aug 2021 08:52:02 +0000 Original-Received: (at 50038) by debbugs.gnu.org; 15 Aug 2021 08:51:02 +0000 Original-Received: from localhost ([127.0.0.1]:45736 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mFBrC-0005Rm-2b for submit@debbugs.gnu.org; Sun, 15 Aug 2021 04:51:02 -0400 Original-Received: from relay12.mail.gandi.net ([217.70.178.232]:49271) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mFBr9-0005RO-Ut for 50038@debbugs.gnu.org; Sun, 15 Aug 2021 04:51:01 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 75555200007; Sun, 15 Aug 2021 08:50:52 +0000 (UTC) In-Reply-To: <83lf54bkft.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Aug 2021 09:37:58 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:211875 Archived-At: --=-=-= Content-Type: text/plain >> +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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=shift-select-mode-permanent-2.patch 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 --=-=-=--