bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#22991: 25.0.92: C-u C-s does not display "Regexp I-search:" in the e


From: Kaushal Modi
Subject: 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

> 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)


reply via email to

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