summaryrefslogtreecommitdiff
path: root/lisp/isearch.el
diff options
context:
space:
mode:
authorKaushal Modi <kaushal.modi@gmail.com>2016-03-14 20:15:17 +0200
committerEli Zaretskii <eliz@gnu.org>2016-03-14 20:15:17 +0200
commit0ce37eac45f8b1279e89e854f71bb3f35fd43d29 (patch)
tree9a0ca1e990ab544c9b9ccf561defd4a8afb364db /lisp/isearch.el
parentf3033d4d028c1cd7c36ce9e9aa82f4a6c33f57c7 (diff)
downloademacs-0ce37eac45f8b1279e89e854f71bb3f35fd43d29.tar.gz
Fix Isearch prompt when invoked with an argument
* 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: " again. 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. (Bug#22991)
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r--lisp/isearch.el19
1 files changed, 15 insertions, 4 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index b8ada2c766a..988503eaa4f 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2574,15 +2574,26 @@ the word 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.