[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: isearch-query-replace-regexp and stuff

From: Juri Linkov
Subject: Re: isearch-query-replace-regexp and stuff
Date: Wed, 07 Jul 2004 08:08:36 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

David Kastrup <address@hidden> writes:
> C-M-s is quite hard to type, and if someone still decided to type it,
> this means only that it was typed with the intention to start a
> regexp search.


The current behavior of C-M-s to repeat the non-regexp search is not
the most reasonable one.  More correct would be to switch the search
to regexp mode before doing the search again.  I guess it works now
that way because it was simpler to implement and nobody cared about
handling this case specially.  But we could change the behavior of C-M-s
in non-regexp mode to switch to regexp mode for consistency with C-M-%.

> Well, my proposal would not have "failed" in the display after the
> switch, so it would be natural not to have the flag set, either.  The
> question is just whether one should change the display to "pending"
> to indicate this change, or simply don't mention this somewhat
> peculiar state at all.

While looking at isearch.el I noticed that `isearch-toggle-case-fold'
already sets the `isearch-adjusted' flag.  It seems the purpose of
this variable exactly fits into your proposal.  We could set it in
`isearch-toggle-regexp' and display "pending" in the echo area.
That way both `isearch-toggle-regexp' and `isearch-toggle-case-fold'
will be equivalent w.r.t. treating of inconsistent state after
switching between case or regexp modes.

Index: lisp/isearch.el
RCS file: /cvsroot/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.230
diff -u -r1.230 isearch.el
--- lisp/isearch.el     1 Jul 2004 09:54:51 -0000       1.230
+++ lisp/isearch.el     7 Jul 2004 03:33:21 -0000
@@ -1043,6 +1043,7 @@
   (setq isearch-regexp (not isearch-regexp))
   (if isearch-regexp (setq isearch-word nil))
+  (setq isearch-success t isearch-adjusted t)
 (defun isearch-toggle-case-fold ()
@@ -1055,33 +1056,27 @@
             (isearch-message-prefix nil nil isearch-nonincremental)
             (if isearch-case-fold-search "in" "")))
-  (setq isearch-adjusted t)
+  (setq isearch-success t isearch-adjusted t)
   (sit-for 1)
@@ -1841,6 +1836,7 @@
   ;; If currently failing, display no ellipsis.
   (or isearch-success (setq ellipsis nil))
   (let ((m (concat (if isearch-success "" "failing ")
+                   (if isearch-adjusted "pending " "")
                   (if (and isearch-wrapped
                            (if isearch-forward
                                (> (point) isearch-opoint)

Juri Linkov

reply via email to

[Prev in Thread] Current Thread [Next in Thread]