summaryrefslogtreecommitdiff
path: root/lisp/isearch.el
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2008-02-12 00:50:44 +0000
committerBastien Guerry <bzg@altern.org>2008-02-12 00:50:44 +0000
commit723e5b84bb1c1a0e3293b4aa95cc5e5f30ceb8b7 (patch)
tree99b537db4d449aa1805c3097968619ebd6595578 /lisp/isearch.el
parent1046da1cf4056438b0e5ce2aa96725fb6999b454 (diff)
downloademacs-723e5b84bb1c1a0e3293b4aa95cc5e5f30ceb8b7.tar.gz
* isearch.el:
(isearch-fail): New face. (isearch-message): Highlight failure part of input.
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r--lisp/isearch.el33
1 files changed, 19 insertions, 14 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 5937498073e..2ede11399af 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -231,6 +231,10 @@ Default value, nil, means edit the string instead."
:group 'basic-faces)
(defvar isearch 'isearch)
+(defface isearch-fail '((t (:foreground "Black" :background "Plum")))
+ "Face for highlighting failed part in Isearch echo-area message."
+ :group 'isearch)
+
(defcustom isearch-lazy-highlight t
"*Controls the lazy-highlighting during incremental search.
When non-nil, all text in the buffer matching the current search
@@ -1955,21 +1959,22 @@ If there is no completion possible, say so and continue searching."
(defun isearch-message (&optional c-q-hack ellipsis)
;; Generate and print the message string.
(let ((cursor-in-echo-area ellipsis)
- (m (concat
+ (cmds isearch-cmds)
+ succ-msg m)
+ (while (not (isearch-success-state (car cmds))) (pop cmds))
+ (setq succ-msg (and cmds (isearch-message-state (car cmds))))
+ (setq m (concat
(isearch-message-prefix c-q-hack ellipsis isearch-nonincremental)
- (if (and (not isearch-success)
- (string-match " +$" isearch-message))
- (concat
- (substring isearch-message 0 (match-beginning 0))
- (propertize (substring isearch-message (match-beginning 0))
- 'face 'trailing-whitespace))
- isearch-message)
- (isearch-message-suffix c-q-hack ellipsis)
- )))
- (if c-q-hack
- m
- (let ((message-log-max nil))
- (message "%s" m)))))
+ succ-msg
+ (and (not isearch-success)
+ (string-match (regexp-quote succ-msg) isearch-message)
+ (not (string= succ-msg isearch-message))
+ (propertize (substring isearch-message (match-end 0))
+ 'face 'isearch-fail))))
+ (when (and (not isearch-success) (string-match " +$" m))
+ (put-text-property (match-beginning 0) (length m) 'face 'trailing-whitespace m))
+ (setq m (concat m (isearch-message-suffix c-q-hack ellipsis)))
+ (if c-q-hack m (let ((message-log-max nil)) (message "%s" m)))))
(defun isearch-message-prefix (&optional c-q-hack ellipsis nonincremental)
;; If about to search, and previous search regexp was invalid,