aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorChong Yidong <[email protected]>2008-08-29 19:15:19 +0000
committerChong Yidong <[email protected]>2008-08-29 19:15:19 +0000
commit36bdf1ff3ca1e776bc4be74f10e20bfbdb8d617a (patch)
treeb4ad5a029e924a9a6a8a05d9f3876eaaef66dc55 /lisp
parent1d9fad13cec8bb15dbf0b564ba02d88a6ea57491 (diff)
(isearch-highlight-regexp): Fix case of highlighted string.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/isearch.el23
1 files changed, 15 insertions, 8 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 42c213a63d..3aed19b9ce 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -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))))
(defun isearch-delete-char ()