GNU bug report logs - #22991
25.0.92: C-u C-s does not display "Regexp I-search:" in the echo area

Previous Next

Package: emacs;

Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>

Date: Fri, 11 Mar 2016 19:50:02 UTC

Severity: normal

Found in version 25.0.92

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Kaushal Modi <kaushal.modi <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Artur Malabarba <arturmalabarba <at> gmail.com>, 22991 <at> debbugs.gnu.org
Subject: Re: bug#22991: 25.0.92: C-u C-s does not display "Regexp I-search:"
 in the echo area
Date: Fri, 11 Mar 2016 16:22:30 -0500
[Message part 1 (text/plain, inline)]
> Which I think is wrong, since the default mode shouldn't show anything
> except "I-search: ".  Right?

Even before this patch, that behavior (Displaying "Regexp I-search:" on C-s
even when search-default-mode is t) was that way. Because, even when
search-default-mode is t, regexp-function still stays nil. So that first
cond form condition evals to nil.

But I discovered a major issue with my patch. So here's a new one which is
less intrusive. I also added explanation for the current priority order in
the cond.

diff --git a/lisp/isearch.el b/lisp/isearch.el
index b8ada2c..7c3d4e3 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2574,16 +2574,23 @@ isearch--describe-regexp-mode
   (when (eq regexp-function t)
     (setq regexp-function #'word-search-regexp))
   (let ((description
-         ;; Don't use a description on the default search mode.
-         (cond ((equal regexp-function search-default-mode) "")
-               (regexp-function
-                (and (symbolp regexp-function)
-                     (or (get regexp-function 'isearch-message-prefix)
-                         "")))
-               (isearch-regexp "regexp ")
-               ;; We're in literal mode. If the default mode is not
-               ;; literal, then describe it.
-               ((functionp search-default-mode) "literal "))))
+         (cond
+          ;; 1. Don't use a description on the default search mode,
+          ;;    only if the default search mode is non-nil.
+          ((and search-default-mode
+                (equal regexp-function search-default-mode)) "")
+          ;; 2. Use the `isearch-message-prefix' set for
+          ;;    `regexp-function' if available.
+          (regexp-function
+           (and (symbolp regexp-function)
+                (or (get regexp-function 'isearch-message-prefix)
+                    "")))
+          ;; 3. Else if `isearch-regexp' is non-nil, set description
+          ;;    to "regexp ".
+          (isearch-regexp "regexp ")
+          ;; 4. And finally, if we're in literal mode (AND if default
+          ;; mode is not literal too), then describe it.
+          ((functionp search-default-mode) "literal "))))
     (if space-before
         ;; Move space from the end to the beginning.
         (replace-regexp-in-string "\\(.*\\) \\'" " \\1" description)
[Message part 2 (text/html, inline)]

This bug report was last modified 9 years and 70 days ago.

Previous Next


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