aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2000-10-12 07:39:14 +0000
committerMiles Bader2000-10-12 07:39:14 +0000
commit4fb2ad983113708e3d1867ac74e91fb84ffeeb18 (patch)
tree639a89ab53b8a7ab1a3ba650d9e917c8256a16bd
parenta4249304d84bb8d27071501c2c9a35e550d01c68 (diff)
downloademacs-4fb2ad983113708e3d1867ac74e91fb84ffeeb18.tar.gz
emacs-4fb2ad983113708e3d1867ac74e91fb84ffeeb18.zip
(isearch-set-lazy-highlight-faces-at): New function.
(isearch-highlight): Restore lazy-isearch face properties at old position, and suppress them at new position. (isearch-dehighlight): Restore lazy-isearch face properties. (isearch-lazy-highlight-update): Add lazy-isearch overlays even over the real isearch overlay, but in that case, don't give it a face property. Use `push'.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/isearch.el70
2 files changed, 60 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 10f3e00b2fa..d1f4dce9159 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12000-10-12 Miles Bader <miles@lsi.nec.co.jp>
2
3 * isearch.el (isearch-set-lazy-highlight-faces-at): New function.
4 (isearch-highlight): Restore lazy-isearch face properties at old
5 position, and suppress them at new position.
6 (isearch-dehighlight): Restore lazy-isearch face properties.
7 (isearch-lazy-highlight-update): Add lazy-isearch overlays even
8 over the real isearch overlay, but in that case, don't give it a
9 face property. Use `push'.
10
12000-10-12 Kenichi Handa <handa@etl.go.jp> 112000-10-12 Kenichi Handa <handa@etl.go.jp>
2 12
3 * man.el (Man-getpage-in-background): Fix previous change. 13 * man.el (Man-getpage-in-background): Fix previous change.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 8367a3b809a..daccf64145f 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1730,16 +1730,47 @@ If there is no completion possible, say so and continue searching."
1730 1730
1731(defvar isearch-overlay nil) 1731(defvar isearch-overlay nil)
1732 1732
1733(defsubst isearch-set-lazy-highlight-faces-at (pos face)
1734 "Set the face property of isearch lazy highlight overlays at POS to FACE.
1735If POS is nil, nothing is done."
1736 (unless (null pos)
1737 (dolist (ov (overlays-at pos))
1738 (when (and (not (eq ov isearch-overlay))
1739 (memq ov isearch-lazy-highlight-overlays)
1740 (not (eq (overlay-get ov 'face) face)))
1741 (overlay-put ov 'face face)))))
1742
1733(defun isearch-highlight (beg end) 1743(defun isearch-highlight (beg end)
1734 (if (or (null search-highlight) (null (display-color-p))) 1744 (unless (or (null search-highlight) (null (display-color-p)))
1735 nil 1745 (cond (isearch-overlay
1736 (or isearch-overlay (setq isearch-overlay (make-overlay beg end))) 1746 ;; Overlay already exists, just move it.
1737 (move-overlay isearch-overlay beg end (current-buffer)) 1747
1738 (overlay-put isearch-overlay 'face isearch))) 1748 ;; Check to see if there are any lazy-isearch overlays at
1749 ;; the same position with their face property suppressed
1750 ;; (to avoid face clashes), and if so, give them their face
1751 ;; back.
1752 (isearch-set-lazy-highlight-faces-at (overlay-start isearch-overlay)
1753 isearch-lazy-highlight-face)
1754
1755 (move-overlay isearch-overlay beg end (current-buffer)))
1756
1757 (t
1758 ;; Overlay doesn't exist, create it.
1759 (setq isearch-overlay (make-overlay beg end))
1760 (overlay-put isearch-overlay 'face isearch)))
1761
1762 ;; Suppress the faces of any lazy-isearch overlays at the new position
1763 (isearch-set-lazy-highlight-faces-at beg nil)))
1739 1764
1740(defun isearch-dehighlight (totally) 1765(defun isearch-dehighlight (totally)
1741 (if isearch-overlay 1766 (when isearch-overlay
1742 (delete-overlay isearch-overlay))) 1767 ;; Check to see if there are any lazy-isearch overlays at the same
1768 ;; position with their face property suppressed (to avoid face
1769 ;; clashes), and if so, give them their face back.
1770 (isearch-set-lazy-highlight-faces-at (overlay-start isearch-overlay)
1771 isearch-lazy-highlight-face)
1772 (delete-overlay isearch-overlay)))
1773
1743 1774
1744;;; General utilities 1775;;; General utilities
1745 1776
@@ -1933,21 +1964,20 @@ Attempt to do the search exactly the way the pending isearch would."
1933 isearch-lazy-highlight-start)) 1964 isearch-lazy-highlight-start))
1934 (let ((found (isearch-lazy-highlight-search))) ;do search 1965 (let ((found (isearch-lazy-highlight-search))) ;do search
1935 (if found 1966 (if found
1936 (progn 1967 ;; found the next match
1937 ;; Don't put a second overlay with a different face 1968 (let ((ov (make-overlay (match-beginning 0)
1938 ;; over/under the overlay isearch uses to highlight the 1969 (match-end 0))))
1939 ;; current match. That can lead to odd looking face 1970 ;; If OV overlaps the current isearch overlay, suppress
1940 ;; combinations. 1971 ;; its face property; otherwise, we sometimes get odd
1972 ;; looking face combinations.
1941 (unless (memq isearch-overlay 1973 (unless (memq isearch-overlay
1942 (overlays-at (match-beginning 0))) 1974 (overlays-at (match-beginning 0)))
1943 ;; found the next match 1975 (overlay-put ov 'face isearch-lazy-highlight-face))
1944 (let ((ov (make-overlay (match-beginning 0) 1976
1945 (match-end 0)))) 1977 (overlay-put ov 'priority 0)
1946 (overlay-put ov 'face isearch-lazy-highlight-face) 1978
1947 (overlay-put ov 'priority 0) 1979 (push ov isearch-lazy-highlight-overlays)
1948 (setq isearch-lazy-highlight-overlays 1980
1949 (cons ov isearch-lazy-highlight-overlays))))
1950
1951 (setq isearch-lazy-highlight-timer 1981 (setq isearch-lazy-highlight-timer
1952 (run-at-time isearch-lazy-highlight-interval nil 1982 (run-at-time isearch-lazy-highlight-interval nil
1953 'isearch-lazy-highlight-update)) 1983 'isearch-lazy-highlight-update))