740 |
(setq ;; quit-flag nil not for isearch-mode |
(setq ;; quit-flag nil not for isearch-mode |
741 |
isearch-adjusted nil |
isearch-adjusted nil |
742 |
isearch-yank-flag nil) |
isearch-yank-flag nil) |
743 |
(if isearch-lazy-highlight (isearch-lazy-highlight-new-loop)) |
(when isearch-lazy-highlight |
744 |
|
(isearch-lazy-highlight-new-loop nil nil)) |
745 |
;; We must prevent the point moving to the end of composition when a |
;; We must prevent the point moving to the end of composition when a |
746 |
;; part of the composition has just been searched. |
;; part of the composition has just been searched. |
747 |
(setq disable-point-adjustment t)) |
(setq disable-point-adjustment t)) |
2315 |
|
|
2316 |
(defvar isearch-lazy-highlight-overlays nil) |
(defvar isearch-lazy-highlight-overlays nil) |
2317 |
(defvar isearch-lazy-highlight-wrapped nil) |
(defvar isearch-lazy-highlight-wrapped nil) |
2318 |
|
(defvar isearch-lazy-highlight-start-limit nil) |
2319 |
|
(defvar isearch-lazy-highlight-end-limit nil) |
2320 |
(defvar isearch-lazy-highlight-start nil) |
(defvar isearch-lazy-highlight-start nil) |
2321 |
(defvar isearch-lazy-highlight-end nil) |
(defvar isearch-lazy-highlight-end nil) |
2322 |
(defvar isearch-lazy-highlight-timer nil) |
(defvar isearch-lazy-highlight-timer nil) |
2342 |
(cancel-timer isearch-lazy-highlight-timer) |
(cancel-timer isearch-lazy-highlight-timer) |
2343 |
(setq isearch-lazy-highlight-timer nil))) |
(setq isearch-lazy-highlight-timer nil))) |
2344 |
|
|
2345 |
(defun isearch-lazy-highlight-new-loop () |
(defun isearch-lazy-highlight-new-loop (beg end) |
2346 |
"Cleanup any previous `lazy-highlight' loop and begin a new one. |
"Cleanup any previous `lazy-highlight' loop and begin a new one. |
2347 |
This happens when `isearch-update' is invoked (which can cause the |
BEG and END specify the bounds within which highlighting should occur. |
2348 |
search string to change or the window to scroll)." |
This is called when `isearch-update' is invoked (which can cause the |
2349 |
|
search string to change or the window to scroll). It is also used |
2350 |
|
by other Emacs features." |
2351 |
(when (and (null executing-kbd-macro) |
(when (and (null executing-kbd-macro) |
2352 |
(sit-for 0) ;make sure (window-start) is credible |
(sit-for 0) ;make sure (window-start) is credible |
2353 |
(or (not (equal isearch-string |
(or (not (equal isearch-string |
2365 |
;; something important did indeed change |
;; something important did indeed change |
2366 |
(isearch-lazy-highlight-cleanup t) ;kill old loop & remove overlays |
(isearch-lazy-highlight-cleanup t) ;kill old loop & remove overlays |
2367 |
(when (not isearch-invalid-regexp) |
(when (not isearch-invalid-regexp) |
2368 |
|
(setq isearch-lazy-highlight-start-limit beg |
2369 |
|
isearch-lazy-highlight-end-limit end) |
2370 |
(setq isearch-lazy-highlight-window (selected-window) |
(setq isearch-lazy-highlight-window (selected-window) |
2371 |
isearch-lazy-highlight-window-start (window-start) |
isearch-lazy-highlight-window-start (window-start) |
2372 |
isearch-lazy-highlight-window-end (window-end) |
isearch-lazy-highlight-window-end (window-end) |
2389 |
(funcall (isearch-search-fun) |
(funcall (isearch-search-fun) |
2390 |
isearch-string |
isearch-string |
2391 |
(if isearch-forward |
(if isearch-forward |
2392 |
(if isearch-lazy-highlight-wrapped |
(min (or isearch-lazy-highlight-end-limit (point-max)) |
2393 |
isearch-lazy-highlight-start |
(if isearch-lazy-highlight-wrapped |
2394 |
(window-end)) |
isearch-lazy-highlight-start |
2395 |
(if isearch-lazy-highlight-wrapped |
(window-end))) |
2396 |
isearch-lazy-highlight-end |
(max (or isearch-lazy-highlight-start-limit (point-min)) |
2397 |
(window-start))) |
(if isearch-lazy-highlight-wrapped |
2398 |
|
isearch-lazy-highlight-end |
2399 |
|
(window-start)))) |
2400 |
t))) |
t))) |
2401 |
|
|
2402 |
(defun isearch-lazy-highlight-update () |
(defun isearch-lazy-highlight-update () |
2455 |
(if isearch-forward |
(if isearch-forward |
2456 |
(progn |
(progn |
2457 |
(setq isearch-lazy-highlight-end (window-start)) |
(setq isearch-lazy-highlight-end (window-start)) |
2458 |
(goto-char (window-start))) |
(goto-char (max (or isearch-lazy-highlight-start-limit (point-min)) |
2459 |
|
(window-start)))) |
2460 |
(setq isearch-lazy-highlight-start (window-end)) |
(setq isearch-lazy-highlight-start (window-end)) |
2461 |
(goto-char (window-end))))))) |
(goto-char (min (or isearch-lazy-highlight-end-limit (point-max)) |
2462 |
|
(window-end)))))))) |
2463 |
(unless nomore |
(unless nomore |
2464 |
(setq isearch-lazy-highlight-timer |
(setq isearch-lazy-highlight-timer |
2465 |
(run-at-time lazy-highlight-interval nil |
(run-at-time lazy-highlight-interval nil |