]> git.eshelyaron.com Git - emacs.git/commitdiff
(isearch-highlight-regexp): Fix case of highlighted string.
authorChong Yidong <cyd@stupidchicken.com>
Fri, 29 Aug 2008 19:15:19 +0000 (19:15 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Fri, 29 Aug 2008 19:15:19 +0000 (19:15 +0000)
lisp/isearch.el

index 42c213a63dd8cb741fb30a19b28034f4a3509430..3aed19b9cebf59bae6b03d00fc62e765d11994a3 100644 (file)
@@ -1393,14 +1393,21 @@ and reads its face argument using `hi-lock-read-face-name'."
   (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))))
 
 \f
 (defun isearch-delete-char ()