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: Fri, 13 Aug 2021 10:04:27 +0300 Organization: LINKOV.NET Message-ID: <87czqif4y5.fsf@mail.linkov.net> 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="34205"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) To: 50038@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 13 09:15:34 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 1mERPi-0008jJ-NV for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Aug 2021 09:15:34 +0200 Original-Received: from localhost ([::1]:56848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mERPg-00081H-MG for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Aug 2021 03:15:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mERPC-0007zS-Eq for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 03:15:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57109) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mERPC-0007ty-87 for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 03:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mERPC-00080q-0q for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 03:15: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: Fri, 13 Aug 2021 07:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50038 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.162883886630686 (code B ref -1); Fri, 13 Aug 2021 07:15:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Aug 2021 07:14:26 +0000 Original-Received: from localhost ([127.0.0.1]:40412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mEROc-0007ys-3d for submit@debbugs.gnu.org; Fri, 13 Aug 2021 03:14:26 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:44348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mEROa-0007yk-2q for submit@debbugs.gnu.org; Fri, 13 Aug 2021 03:14:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEROZ-0007yo-U0 for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 03:14:23 -0400 Original-Received: from relay9-d.mail.gandi.net ([217.70.183.199]:34977) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEROX-0007Ha-Td for bug-gnu-emacs@gnu.org; Fri, 13 Aug 2021 03:14:23 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 30E1DFF802 for ; Fri, 13 Aug 2021 07:14:17 +0000 (UTC) Received-SPF: pass client-ip=217.70.183.199; envelope-from=juri@linkov.net; helo=relay9-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:211717 Archived-At: --=-=-= Content-Type: text/plain 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": --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=shift-select-mode-permanent.patch 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 --=-=-=--