changeset 97861:5a2400fab3c3

(isearch-highlight-regexp): Fix case of highlighted string.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 29 Aug 2008 19:15:19 +0000
parents fa6ba1400de1
children 8722b76bdf46
files lisp/isearch.el
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/isearch.el	Fri Aug 29 19:14:57 2008 +0000
+++ b/lisp/isearch.el	Fri Aug 29 19:15:19 2008 +0000
@@ -1393,14 +1393,21 @@
   (isearch-done)
   (isearch-clean-overlays)
   (require 'hi-lock nil t)
-  ;; (add-to-history 'hi-lock-regexp-history regexp)
-  (let ((case-fold-search isearch-case-fold-search)
-	;; TODO: add `search-upper-case' as in `isearch-occur'
-	)
-    (hi-lock-face-buffer
-     (hi-lock-regexp-okay
-      (if isearch-regexp isearch-string (regexp-quote isearch-string)))
-     (hi-lock-read-face-name))))
+  (let ((string (cond (isearch-regexp isearch-string)
+		      ((if (and (eq isearch-case-fold-search t)
+				search-upper-case)
+			   (isearch-no-upper-case-p
+			    isearch-string isearch-regexp)
+			 isearch-case-fold-search)
+		       ;; Turn isearch-string into a case-insensitive
+		       ;; regexp.
+		       (replace-regexp-in-string
+			"[a-z]"
+			(lambda (m)
+			  (format "[%s%s]" (upcase m) (downcase m)))
+			isearch-string))
+		      (t (regexp-quote isearch-string)))))
+    (hi-lock-face-buffer string (hi-lock-read-face-name))))
 
 
 (defun isearch-delete-char ()