238 |
(defcustom lazy-highlight-cleanup t |
(defcustom lazy-highlight-cleanup t |
239 |
"*Controls whether to remove extra highlighting after a search. |
"*Controls whether to remove extra highlighting after a search. |
240 |
If this is nil, extra highlighting can be \"manually\" removed with |
If this is nil, extra highlighting can be \"manually\" removed with |
241 |
\\[isearch-lazy-highlight-cleanup]." |
\\[lazy-highlight-cleanup]." |
242 |
:type 'boolean |
:type 'boolean |
243 |
:group 'lazy-highlight) |
:group 'lazy-highlight) |
244 |
(defvaralias 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup) |
(defvaralias 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup) |
245 |
(make-obsolete-variable 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup) |
(make-obsolete-variable 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup "22.1") |
246 |
|
|
247 |
(defcustom lazy-highlight-initial-delay 0.25 |
(defcustom lazy-highlight-initial-delay 0.25 |
248 |
"*Seconds to wait before beginning to lazily highlight all matches." |
"*Seconds to wait before beginning to lazily highlight all matches." |
249 |
:type 'number |
:type 'number |
250 |
:group 'lazy-highlight) |
:group 'lazy-highlight) |
251 |
(defvaralias 'isearch-lazy-highlight-initial-delay 'lazy-highlight-initial-delay) |
(defvaralias 'isearch-lazy-highlight-initial-delay 'lazy-highlight-initial-delay) |
252 |
(make-obsolete-variable 'isearch-lazy-highlight-initial-delay 'lazy-highlight-initial-delay) |
(make-obsolete-variable 'isearch-lazy-highlight-initial-delay 'lazy-highlight-initial-delay "22.1") |
253 |
|
|
254 |
(defcustom lazy-highlight-interval 0 ; 0.0625 |
(defcustom lazy-highlight-interval 0 ; 0.0625 |
255 |
"*Seconds between lazily highlighting successive matches." |
"*Seconds between lazily highlighting successive matches." |
256 |
:type 'number |
:type 'number |
257 |
:group 'lazy-highlight) |
:group 'lazy-highlight) |
258 |
(defvaralias 'isearch-lazy-highlight-interval 'lazy-highlight-interval) |
(defvaralias 'isearch-lazy-highlight-interval 'lazy-highlight-interval) |
259 |
(make-obsolete-variable 'isearch-lazy-highlight-interval 'lazy-highlight-interval) |
(make-obsolete-variable 'isearch-lazy-highlight-interval 'lazy-highlight-interval "22.1") |
260 |
|
|
261 |
(defcustom lazy-highlight-max-at-a-time 20 |
(defcustom lazy-highlight-max-at-a-time 20 |
262 |
"*Maximum matches to highlight at a time (for `lazy-highlight'). |
"*Maximum matches to highlight at a time (for `lazy-highlight'). |
267 |
(integer :tag "Some")) |
(integer :tag "Some")) |
268 |
:group 'lazy-highlight) |
:group 'lazy-highlight) |
269 |
(defvaralias 'isearch-lazy-highlight-max-at-a-time 'lazy-highlight-max-at-a-time) |
(defvaralias 'isearch-lazy-highlight-max-at-a-time 'lazy-highlight-max-at-a-time) |
270 |
(make-obsolete-variable 'isearch-lazy-highlight-max-at-a-time 'lazy-highlight-max-at-a-time) |
(make-obsolete-variable 'isearch-lazy-highlight-max-at-a-time 'lazy-highlight-max-at-a-time "22.1") |
271 |
|
|
272 |
(defface lazy-highlight |
(defface lazy-highlight |
273 |
'((((class color) (min-colors 88) (background light)) |
'((((class color) (min-colors 88) (background light)) |
284 |
(put 'isearch-lazy-highlight-face 'face-alias 'lazy-highlight) |
(put 'isearch-lazy-highlight-face 'face-alias 'lazy-highlight) |
285 |
(defvar lazy-highlight-face 'lazy-highlight) |
(defvar lazy-highlight-face 'lazy-highlight) |
286 |
(defvaralias 'isearch-lazy-highlight-face 'lazy-highlight-face) |
(defvaralias 'isearch-lazy-highlight-face 'lazy-highlight-face) |
287 |
(make-obsolete-variable 'isearch-lazy-highlight-face 'lazy-highlight-face) |
(make-obsolete-variable 'isearch-lazy-highlight-face 'lazy-highlight-face "22.1") |
288 |
|
|
289 |
;; Define isearch-mode keymap. |
;; Define isearch-mode keymap. |
290 |
|
|
768 |
;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs |
;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs |
769 |
(setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout) |
(setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout) |
770 |
(isearch-dehighlight) |
(isearch-dehighlight) |
771 |
(isearch-lazy-highlight-cleanup lazy-highlight-cleanup) |
(lazy-highlight-cleanup lazy-highlight-cleanup) |
772 |
(let ((found-start (window-start (selected-window))) |
(let ((found-start (window-start (selected-window))) |
773 |
(found-point (point))) |
(found-point (point))) |
774 |
(if isearch-window-configuration |
(if isearch-window-configuration |
2329 |
(defvar isearch-lazy-highlight-case-fold-search nil) |
(defvar isearch-lazy-highlight-case-fold-search nil) |
2330 |
(defvar isearch-lazy-highlight-regexp nil) |
(defvar isearch-lazy-highlight-regexp nil) |
2331 |
|
|
2332 |
(defun isearch-lazy-highlight-cleanup (&optional force) |
(defun lazy-highlight-cleanup (&optional force) |
2333 |
"Stop lazy highlighting and remove extra highlighting from current buffer. |
"Stop lazy highlighting and remove extra highlighting from current buffer. |
2334 |
FORCE non-nil means do it whether or not `lazy-highlight-cleanup' |
FORCE non-nil means do it whether or not `lazy-highlight-cleanup' |
2335 |
is nil. This function is called when exiting an incremental search if |
is nil. This function is called when exiting an incremental search if |
2344 |
(cancel-timer isearch-lazy-highlight-timer) |
(cancel-timer isearch-lazy-highlight-timer) |
2345 |
(setq isearch-lazy-highlight-timer nil))) |
(setq isearch-lazy-highlight-timer nil))) |
2346 |
|
|
2347 |
|
(defalias 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup) |
2348 |
|
(make-obsolete 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup "22.1") |
2349 |
|
|
2350 |
(defun isearch-lazy-highlight-new-loop (beg end) |
(defun isearch-lazy-highlight-new-loop (beg end) |
2351 |
"Cleanup any previous `lazy-highlight' loop and begin a new one. |
"Cleanup any previous `lazy-highlight' loop and begin a new one. |
2352 |
BEG and END specify the bounds within which highlighting should occur. |
BEG and END specify the bounds within which highlighting should occur. |
2368 |
(not (= (window-end) ; Window may have been split/joined. |
(not (= (window-end) ; Window may have been split/joined. |
2369 |
isearch-lazy-highlight-window-end)))) |
isearch-lazy-highlight-window-end)))) |
2370 |
;; something important did indeed change |
;; something important did indeed change |
2371 |
(isearch-lazy-highlight-cleanup t) ;kill old loop & remove overlays |
(lazy-highlight-cleanup t) ;kill old loop & remove overlays |
2372 |
(when (not isearch-error) |
(when (not isearch-error) |
2373 |
(setq isearch-lazy-highlight-start-limit beg |
(setq isearch-lazy-highlight-start-limit beg |
2374 |
isearch-lazy-highlight-end-limit end) |
isearch-lazy-highlight-end-limit end) |
2446 |
;; non-zero-length match |
;; non-zero-length match |
2447 |
(let ((ov (make-overlay mb me))) |
(let ((ov (make-overlay mb me))) |
2448 |
(push ov isearch-lazy-highlight-overlays) |
(push ov isearch-lazy-highlight-overlays) |
2449 |
(overlay-put ov 'face isearch-lazy-highlight-face) |
(overlay-put ov 'face lazy-highlight-face) |
2450 |
(overlay-put ov 'priority 0) ;lower than main overlay |
(overlay-put ov 'priority 0) ;lower than main overlay |
2451 |
(overlay-put ov 'window (selected-window)))) |
(overlay-put ov 'window (selected-window)))) |
2452 |
(if isearch-forward |
(if isearch-forward |