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 17:36:32 -0500


On Fri, Mar 11, 2016 at 5:22 PM, Artur Malabarba <bruce.connor.am@gmail.com> wrote:

This last patch looks fine to me. 👍


Thanks.

Here's one more shot with fix for that bug that was already there that Eli mentioned.
Now if the user has set search-default-mode to t and if they do C-s, the description is still "" (not "regexp "). So the minibuffer would read "I-search: ".

Below is the patch created using git format-patch with appropriate commit log.

From df1a6e8e9d8227f5c137236a09fda9818c479d0c Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Date: Fri, 11 Mar 2016 17:34:50 -0500
Subject: [PATCH] Fix description for regexp searches (bug 22991)

* lisp/isearch.el (isearch--describe-regexp-mode): With
  `search-default-mode' set to nil, if user does C-u C-s, the minibuffer
  now displays "Regexp I-search: ".  But if the user has set
  `search-default-mode' to t, and then does C-s, the minibuffer now
  displays "I-search: " because the default search mode is now regexp
  mode.  Comments have been added to explain the priority of conditions
  in the `cond' form.
---
 lisp/isearch.el | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index b8ada2c..646a906 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2574,15 +2574,26 @@ 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) "")
+         (cond
+          ;; 1. Do not use a description on the default search mode,
+          ;;    but only if the default search mode is non-nil.
+          ((or (and search-default-mode
+                    (equal search-default-mode regexp-function))
+               ;; Special case where `search-default-mode' is t
+               ;; (defaults to regexp searches).
+               (and (eq search-default-mode t)
+                    (eq search-default-mode isearch-regexp))) "")
+          ;; 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 ")
-               ;; We're in literal mode. If the default mode is not
-               ;; literal, then describe it.
+          ;; 4. And finally, if we're in literal mode (and if the
+          ;;    default mode is also not literal), describe it.
           ((functionp search-default-mode) "literal "))))
     (if space-before
         ;; Move space from the end to the beginning.
--
2.6.0.rc0.24.gec371ff



--
Kaushal Modi

reply via email to

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