From: Lars Ingebrigtsen <larsi@gnus.org>
To: Juri Linkov <juri@jurta.org>
Cc: 12986@debbugs.gnu.org, Kelly Dean <kellydeanch@yahoo.com>
Subject: bug#12986: Pressing backspace during isearch exits case-sensitive and word modes
Date: Tue, 13 Oct 2020 04:26:48 +0200 [thread overview]
Message-ID: <877dru97yv.fsf@gnus.org> (raw)
In-Reply-To: <87obbolu5c.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 02 Jun 2013 12:49:19 +0300")
Juri Linkov <juri@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
next prev parent reply other threads:[~2020-10-13 2:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1354124058.21763.YahooMailClassic@web141103.mail.bf1.yahoo.com>
2012-11-28 23:15 ` bug#12986: Pressing backspace during isearch exits case-sensitive and word modes Juri Linkov
2013-06-02 9:49 ` Juri Linkov
2020-10-13 2:26 ` Lars Ingebrigtsen [this message]
2021-05-10 11:20 ` Lars Ingebrigtsen
2021-05-11 17:56 ` Juri Linkov
2022-09-11 11:51 ` Lars Ingebrigtsen
2023-10-01 2:07 ` Stefan Kangas
2012-11-25 1:55 Kelly Dean
2012-11-25 9:32 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877dru97yv.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=12986@debbugs.gnu.org \
--cc=juri@jurta.org \
--cc=kellydeanch@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).