GNU bug report logs - #12986
Pressing backspace during isearch exits case-sensitive and word modes

Previous Next

Package: emacs;

Reported by: Kelly Dean <kellydeanch <at> yahoo.com>

Date: Sun, 25 Nov 2012 01:58:02 UTC

Severity: minor

Tags: patch

To reply to this bug, email your comments to 12986 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12986; Package emacs. (Sun, 25 Nov 2012 01:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kelly Dean <kellydeanch <at> yahoo.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 25 Nov 2012 01:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kelly Dean <kellydeanch <at> yahoo.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Pressing backspace during isearch exits case-sensitive and word modes
Date: Sat, 24 Nov 2012 17:55:22 -0800 (PST)
Using 24.2, type:
onto to
Then do:
C-a C-s to
It highlights the first occurrence of "to" as the current match, and the second as the next match.
Then do: M-s w
Now, if you type a space, it continues in word mode as expected, but if instead you backspace over the o, it exits word mode. It shouldn't do that.
This same problem applies to case-sensitivity mode (M-c) too.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12986; Package emacs. (Sun, 25 Nov 2012 09:55:02 GMT) Full text and rfc822 format available.

Message #8 received at 12986 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Kelly Dean <kellydeanch <at> yahoo.com>
Cc: 12986 <at> debbugs.gnu.org
Subject: Re: bug#12986: Pressing backspace during isearch exits case-sensitive
	and word modes
Date: Sun, 25 Nov 2012 11:32:03 +0200
> Using 24.2, type:
> onto to
> Then do:
> C-a C-s to
> It highlights the first occurrence of "to" as the current match,
> and the second as the next match.
> Then do: M-s w
> Now, if you type a space, it continues in word mode as expected, but
> if instead you backspace over the o, it exits word mode. It shouldn't do that.
> This same problem applies to case-sensitivity mode (M-c) too.

<backspace> (isearch-delete-char) restores the previous search state.
If you want just to remove the last character from the search string,
you can type `C-M-w' (isearch-del-char).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12986; Package emacs. (Wed, 28 Nov 2012 23:33:01 GMT) Full text and rfc822 format available.

Message #11 received at 12986 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Kelly Dean <kellydeanch <at> yahoo.com>
Cc: 12986 <at> debbugs.gnu.org
Subject: Re: bug#12986: Pressing backspace during isearch exits case-sensitive
	and word modes
Date: Thu, 29 Nov 2012 01:15:14 +0200
[please keep your replies Cc'd to 12986 <at> debbugs.gnu.org]

>> <backspace> (isearch-delete-char) restores the previous search state.
>> If you want just to remove the last character from the search string,
>> you can type `C-M-w' (isearch-del-char).

> Sorry for the mistaken bug report. But it still seems to be a UI
> inconsistency: although the described behavior happens for word mode and
> case-insensitivity mode, it doesn't happen for regex mode, which it what
> led me to believe it was a bug for the first two. If it's supposed to
> happen for the first two, then shouldn't it happen for all three?

Good point.  `isearch-delete-char' (that uses `isearch-pop-state')
restores word mode but not regexp mode.  This looks like
unaccountable inconsistency.  Perhaps it should restore
regexp mode as well.

Case-insensitivity is already restored when you type <backspace>
but you can't see this because it has no indication in the prompt.
Maybe it should momentarily flash a case sensitivity indicator
when you type <backspace> like it does when you type `M-c'
(but only when <backspace> changes the state of case-insensitivity).

The recently added `isearch-lax-whitespace' could be saved/restored too.

For customizability a new user option could be added to define a list
of search states that the user wants to keep on the isearch stack.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12986; Package emacs. (Sun, 02 Jun 2013 09:56:05 GMT) Full text and rfc822 format available.

Message #14 received at 12986 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Kelly Dean <kellydeanch <at> yahoo.com>
Cc: 12986 <at> debbugs.gnu.org
Subject: Re: bug#12986: Pressing backspace during isearch exits case-sensitive
	and word modes
Date: Sun, 02 Jun 2013 12:49:19 +0300
>> But it still seems to be a UI inconsistency: although the described
>> behavior happens for word mode and case-insensitivity mode, it
>> doesn't happen for regex mode, which it what led me to believe it was
>> a bug for the first two. If it's supposed to happen for the first two,
>> then shouldn't it happen for all three?
>
> Good point.  `isearch-delete-char' (that uses `isearch-pop-state')
> restores word mode but not regexp mode.  This looks like
> unaccountable inconsistency.  Perhaps it should restore
> regexp mode as well.
>
> Case-insensitivity is already restored when you type <backspace>
> but you can't see this because it has no indication in the prompt.
> Maybe it should momentarily flash a case sensitivity indicator
> when you type <backspace> like it does when you type `M-c'
> (but only when <backspace> changes the state of case-insensitivity).
>
> The recently added `isearch-lax-whitespace' could be saved/restored too.
>
> For customizability a new user option could be added to define a list
> of search states that the user wants to keep on the isearch stack.

This patch adds a new user option `isearch-keep-stack-variables'
intended to accompany another option `isearch-keep-mode-variables'
added in bug#11378.  It adds a new option but doesn't change
the default behavior - its default value is `isearch-regexp'
that means to not keep regexp mode when pressing backspace
(other search variables will be supported later as well).

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el	2013-05-30 23:50:36 +0000
+++ lisp/isearch.el	2013-06-02 09:45:01 +0000
@@ -153,6 +153,17 @@ (defcustom isearch-hide-immediately t
   :type 'boolean
   :group 'isearch)
 
+(defcustom isearch-keep-stack-variables '(isearch-regexp)
+  "A set of search variables to keep and not to restore from the search stack."
+  :type '(set (const :tag "Regexp search" isearch-regexp)
+	      (const :tag "Case folding" isearch-case-fold-search)
+	      (const :tag "Invisible text" isearch-invisible)
+	      (const :tag "Filters" isearch-filter-predicates)
+	      (const :tag "Lax whitespace" isearch-lax-whitespace)
+	      (const :tag "Regexp lax whitespace" isearch-regexp-lax-whitespace))
+  :version "24.4"
+  :group 'isearch)
+
 (defcustom isearch-resume-in-command-history nil
   "If non-nil, `isearch-resume' commands are added to the command history.
 This allows you to resume earlier Isearch sessions through the
@@ -1109,6 +1143,7 @@ (cl-defstruct (isearch--state
                  (case-fold-search isearch-case-fold-search)
                  (pop-fun (if isearch-push-state-function
                               (funcall isearch-push-state-function)))
+		 (regexp isearch-regexp)
 		 (filter-predicates isearch-filter-predicates))))
   (string :read-only t)
   (message :read-only t)
@@ -1122,6 +1157,7 @@ (cl-defstruct (isearch--state
   (barrier :read-only t)
   (case-fold-search :read-only t)
   (pop-fun :read-only t)
+  (regexp :read-only t)
   (filter-predicates :read-only t))
 
 (defun isearch--set-state (cmd)
@@ -1136,6 +1172,8 @@ (defun isearch--set-state (cmd)
 	isearch-barrier (isearch--state-barrier cmd)
 	isearch-case-fold-search (isearch--state-case-fold-search cmd)
 	isearch-filter-predicates (isearch--state-filter-predicates cmd))
+  (unless (memq 'isearch-regexp isearch-keep-stack-variables)
+    (setq isearch-regexp (isearch--state-regexp cmd)))
   (if (functionp (isearch--state-pop-fun cmd))
       (funcall (isearch--state-pop-fun cmd) cmd))
   (goto-char (isearch--state-point cmd)))





Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 25 Aug 2020 12:05:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12986; Package emacs. (Tue, 13 Oct 2020 02:28:01 GMT) Full text and rfc822 format available.

Message #19 received at 12986 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12986 <at> debbugs.gnu.org, Kelly Dean <kellydeanch <at> yahoo.com>
Subject: Re: bug#12986: Pressing backspace during isearch exits
 case-sensitive and word modes
Date: Tue, 13 Oct 2020 04:26:48 +0200
Juri Linkov <juri <at> jurta.org> writes:

>> Good point.  `isearch-delete-char' (that uses `isearch-pop-state')
>> restores word mode but not regexp mode.  This looks like
>> unaccountable inconsistency.  Perhaps it should restore
>> regexp mode as well.

[...]

> This patch adds a new user option `isearch-keep-stack-variables'
> intended to accompany another option `isearch-keep-mode-variables'
> added in bug#11378.  It adds a new option but doesn't change
> the default behavior - its default value is `isearch-regexp'
> that means to not keep regexp mode when pressing backspace
> (other search variables will be supported later as well).

I respun the patch for Emacs 28, but looking at it, I guess it doesn't
support actually restoring the modes it's discussing?

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 0879f948cf..e9a3a2e921 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -167,6 +167,17 @@ isearch-hide-immediately
 the search, with the exception of the last successful match, if any."
   :type 'boolean)
 
+(defcustom isearch-keep-stack-variables '(isearch-regexp)
+  "A set of search variables to keep and not to restore from the search stack."
+  :type '(set (const :tag "Regexp search" isearch-regexp)
+	      (const :tag "Case folding" isearch-case-fold-search)
+	      (const :tag "Invisible text" isearch-invisible)
+	      (const :tag "Filters" isearch-filter-predicates)
+	      (const :tag "Lax whitespace" isearch-lax-whitespace)
+	      (const :tag "Regexp lax whitespace" isearch-regexp-lax-whitespace))
+  :version "28.1"
+  :group 'isearch)
+
 (defcustom isearch-resume-in-command-history nil
   "If non-nil, `isearch-resume' commands are added to the command history.
 This allows you to resume earlier Isearch sessions through the
@@ -1515,6 +1526,7 @@ isearch-update-from-string-properties
                  (case-fold-search isearch-case-fold-search)
                  (pop-fun (if isearch-push-state-function
                               (funcall isearch-push-state-function)))
+		 (regexp isearch-regexp)
                  (match-data isearch-match-data))))
   (string nil :read-only t)
   (message nil :read-only t)
@@ -1528,6 +1540,7 @@ isearch-update-from-string-properties
   (barrier nil :read-only t)
   (case-fold-search nil :read-only t)
   (pop-fun nil :read-only t)
+  (regexp :read-only t)
   (match-data nil :read-only t))
 
 (defun isearch--set-state (cmd)
@@ -1542,6 +1555,8 @@ isearch--set-state
 	isearch-barrier (isearch--state-barrier cmd)
 	isearch-case-fold-search (isearch--state-case-fold-search cmd)
 	isearch-match-data (isearch--state-match-data cmd))
+  (unless (memq 'isearch-regexp isearch-keep-stack-variables)
+    (setq isearch-regexp (isearch--state-regexp cmd)))
   (if (functionp (isearch--state-pop-fun cmd))
       (funcall (isearch--state-pop-fun cmd) cmd))
   (goto-char (isearch--state-point cmd)))

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12986; Package emacs. (Mon, 10 May 2021 11:21:01 GMT) Full text and rfc822 format available.

Message #22 received at 12986 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12986 <at> debbugs.gnu.org, Kelly Dean <kellydeanch <at> yahoo.com>
Subject: Re: bug#12986: Pressing backspace during isearch exits
 case-sensitive and word modes
Date: Mon, 10 May 2021 13:20:41 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I respun the patch for Emacs 28, but looking at it, I guess it doesn't
> support actually restoring the modes it's discussing?

But I guess since the companion patch in bug#11378 was never applied,
it's a moot issue.  Juri, is this something that should still be worked
on, or has this patch (and the one in bug#11378) been abandoned?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12986; Package emacs. (Tue, 11 May 2021 18:32:02 GMT) Full text and rfc822 format available.

Message #25 received at 12986 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 12986 <at> debbugs.gnu.org, Kelly Dean <kellydeanch <at> yahoo.com>
Subject: Re: bug#12986: Pressing backspace during isearch exits
 case-sensitive and word modes
Date: Tue, 11 May 2021 20:56:06 +0300
>> I respun the patch for Emacs 28, but looking at it, I guess it doesn't
>> support actually restoring the modes it's discussing?
>
> But I guess since the companion patch in bug#11378 was never applied,
> it's a moot issue.  Juri, is this something that should still be worked
> on, or has this patch (and the one in bug#11378) been abandoned?

This feature is currently under discussion with Augusto.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12986; Package emacs. (Sun, 11 Sep 2022 11:52:01 GMT) Full text and rfc822 format available.

Message #28 received at 12986 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12986 <at> debbugs.gnu.org, Kelly Dean <kellydeanch <at> yahoo.com>
Subject: Re: bug#12986: Pressing backspace during isearch exits
 case-sensitive and word modes
Date: Sun, 11 Sep 2022 13:51:45 +0200
Juri Linkov <juri <at> jurta.org> writes:

>>> I respun the patch for Emacs 28, but looking at it, I guess it doesn't
>>> support actually restoring the modes it's discussing?
>>
>> But I guess since the companion patch in bug#11378 was never applied,
>> it's a moot issue.  Juri, is this something that should still be worked
>> on, or has this patch (and the one in bug#11378) been abandoned?
>
> This feature is currently under discussion with Augusto.

This was a year ago -- was there any further progress?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12986; Package emacs. (Sun, 01 Oct 2023 02:09:02 GMT) Full text and rfc822 format available.

Message #31 received at 12986 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Juri Linkov <juri <at> jurta.org>, 12986 <at> debbugs.gnu.org,
 Kelly Dean <kellydeanch <at> yahoo.com>
Subject: Re: bug#12986: Pressing backspace during isearch exits case-sensitive
 and word modes
Date: Sat, 30 Sep 2023 19:07:49 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Juri Linkov <juri <at> jurta.org> writes:
>
>>>> I respun the patch for Emacs 28, but looking at it, I guess it doesn't
>>>> support actually restoring the modes it's discussing?
>>>
>>> But I guess since the companion patch in bug#11378 was never applied,
>>> it's a moot issue.  Juri, is this something that should still be worked
>>> on, or has this patch (and the one in bug#11378) been abandoned?
>>
>> This feature is currently under discussion with Augusto.
>
> This was a year ago -- was there any further progress?

Another year has passed -- has there been any progress here?




This bug report was last modified 1 year and 255 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.