emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/isearch.el,v


From: Juri Linkov
Subject: [Emacs-diffs] Changes to emacs/lisp/isearch.el,v
Date: Mon, 25 Feb 2008 00:01:41 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juri Linkov <jurta>     08/02/25 00:01:41

Index: isearch.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.311
retrieving revision 1.312
diff -u -b -r1.311 -r1.312
--- isearch.el  24 Feb 2008 10:08:55 -0000      1.311
+++ isearch.el  25 Feb 2008 00:01:41 -0000      1.312
@@ -231,8 +231,20 @@
   :group 'basic-faces)
 (defvar isearch 'isearch)
 
-(defface isearch-fail '((t (:foreground "Black" :background "Plum")))
+(defface isearch-fail
+  '((((class color) (min-colors 88) (background light))
+     (:background "RosyBrown1"))
+    (((class color) (min-colors 88) (background dark))
+     (:background "red4"))
+    (((class color) (min-colors 16))
+     (:background "red"))
+    (((class color) (min-colors 8))
+     (:background "red"))
+    (((class color grayscale))
+     :foreground "grey")
+    (t (:inverse-video t)))
   "Face for highlighting failed part in Isearch echo-area message."
+  :version "23.1"
   :group 'isearch)
 
 (defcustom isearch-lazy-highlight t
@@ -1959,21 +1971,27 @@
 (defun isearch-message (&optional c-q-hack ellipsis)
   ;; Generate and print the message string.
   (let ((cursor-in-echo-area ellipsis)
+       (m isearch-message)
           (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))))
+       succ-msg)
+    (when (or (not isearch-success) isearch-error)
+      ;; Highlight failed part
+      (while (or (not (isearch-success-state (car cmds)))
+                (isearch-error-state (car cmds)))
+       (pop cmds))
+      (setq succ-msg (and cmds (isearch-message-state (car cmds)))
+           m (copy-sequence m))
+      (when (and (stringp succ-msg) (< (length succ-msg) (length m)))
+       (add-text-properties (length succ-msg) (length m)
+                            '(face isearch-fail) m))
+      ;; Highlight failed trailing whitespace
+      (when (string-match " +$" m)
+       (add-text-properties (match-beginning 0) (match-end 0)
+                            '(face trailing-whitespace) m)))
       (setq m (concat
            (isearch-message-prefix c-q-hack ellipsis isearch-nonincremental)
-               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)))
+            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)




reply via email to

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