diff options
| author | Richard M. Stallman | 2005-02-16 09:41:02 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-02-16 09:41:02 +0000 |
| commit | f9114cec076c8e41fd5601134de07a7e40f4859f (patch) | |
| tree | 7c2beaeeec8c9d11a3d729a568f4021ea54f4be4 | |
| parent | 784a48b2ef4e99cf2668f5918b906469d3466e70 (diff) | |
| download | emacs-f9114cec076c8e41fd5601134de07a7e40f4859f.tar.gz emacs-f9114cec076c8e41fd5601134de07a7e40f4859f.zip | |
(isearch-lazy-highlight-start-limit)
(isearch-lazy-highlight-end-limit): New variables limit
the region for highlighting.
(isearch-lazy-highlight-new-loop): New args BEG and END.
(isearch-lazy-highlight-search): Use the new vars.
(isearch-lazy-highlight-update): Likewise.
| -rw-r--r-- | lisp/isearch.el | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 6aae4b32533..bc8e1533351 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -740,7 +740,8 @@ is treated as a regexp. See \\[isearch-forward] for more info." | |||
| 740 | (setq ;; quit-flag nil not for isearch-mode | 740 | (setq ;; quit-flag nil not for isearch-mode |
| 741 | isearch-adjusted nil | 741 | isearch-adjusted nil |
| 742 | isearch-yank-flag nil) | 742 | isearch-yank-flag nil) |
| 743 | (if isearch-lazy-highlight (isearch-lazy-highlight-new-loop)) | 743 | (when isearch-lazy-highlight |
| 744 | (isearch-lazy-highlight-new-loop nil nil)) | ||
| 744 | ;; We must prevent the point moving to the end of composition when a | 745 | ;; We must prevent the point moving to the end of composition when a |
| 745 | ;; part of the composition has just been searched. | 746 | ;; part of the composition has just been searched. |
| 746 | (setq disable-point-adjustment t)) | 747 | (setq disable-point-adjustment t)) |
| @@ -2314,6 +2315,8 @@ since they have special meaning in a regexp." | |||
| 2314 | 2315 | ||
| 2315 | (defvar isearch-lazy-highlight-overlays nil) | 2316 | (defvar isearch-lazy-highlight-overlays nil) |
| 2316 | (defvar isearch-lazy-highlight-wrapped nil) | 2317 | (defvar isearch-lazy-highlight-wrapped nil) |
| 2318 | (defvar isearch-lazy-highlight-start-limit nil) | ||
| 2319 | (defvar isearch-lazy-highlight-end-limit nil) | ||
| 2317 | (defvar isearch-lazy-highlight-start nil) | 2320 | (defvar isearch-lazy-highlight-start nil) |
| 2318 | (defvar isearch-lazy-highlight-end nil) | 2321 | (defvar isearch-lazy-highlight-end nil) |
| 2319 | (defvar isearch-lazy-highlight-timer nil) | 2322 | (defvar isearch-lazy-highlight-timer nil) |
| @@ -2339,10 +2342,12 @@ is nil. This function is called when exiting an incremental search if | |||
| 2339 | (cancel-timer isearch-lazy-highlight-timer) | 2342 | (cancel-timer isearch-lazy-highlight-timer) |
| 2340 | (setq isearch-lazy-highlight-timer nil))) | 2343 | (setq isearch-lazy-highlight-timer nil))) |
| 2341 | 2344 | ||
| 2342 | (defun isearch-lazy-highlight-new-loop () | 2345 | (defun isearch-lazy-highlight-new-loop (beg end) |
| 2343 | "Cleanup any previous `lazy-highlight' loop and begin a new one. | 2346 | "Cleanup any previous `lazy-highlight' loop and begin a new one. |
| 2344 | This happens when `isearch-update' is invoked (which can cause the | 2347 | BEG and END specify the bounds within which highlighting should occur. |
| 2345 | search string to change or the window to scroll)." | 2348 | 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." | ||
| 2346 | (when (and (null executing-kbd-macro) | 2351 | (when (and (null executing-kbd-macro) |
| 2347 | (sit-for 0) ;make sure (window-start) is credible | 2352 | (sit-for 0) ;make sure (window-start) is credible |
| 2348 | (or (not (equal isearch-string | 2353 | (or (not (equal isearch-string |
| @@ -2360,6 +2365,8 @@ search string to change or the window to scroll)." | |||
| 2360 | ;; something important did indeed change | 2365 | ;; something important did indeed change |
| 2361 | (isearch-lazy-highlight-cleanup t) ;kill old loop & remove overlays | 2366 | (isearch-lazy-highlight-cleanup t) ;kill old loop & remove overlays |
| 2362 | (when (not isearch-invalid-regexp) | 2367 | (when (not isearch-invalid-regexp) |
| 2368 | (setq isearch-lazy-highlight-start-limit beg | ||
| 2369 | isearch-lazy-highlight-end-limit end) | ||
| 2363 | (setq isearch-lazy-highlight-window (selected-window) | 2370 | (setq isearch-lazy-highlight-window (selected-window) |
| 2364 | isearch-lazy-highlight-window-start (window-start) | 2371 | isearch-lazy-highlight-window-start (window-start) |
| 2365 | isearch-lazy-highlight-window-end (window-end) | 2372 | isearch-lazy-highlight-window-end (window-end) |
| @@ -2382,12 +2389,14 @@ Attempt to do the search exactly the way the pending isearch would." | |||
| 2382 | (funcall (isearch-search-fun) | 2389 | (funcall (isearch-search-fun) |
| 2383 | isearch-string | 2390 | isearch-string |
| 2384 | (if isearch-forward | 2391 | (if isearch-forward |
| 2385 | (if isearch-lazy-highlight-wrapped | 2392 | (min (or isearch-lazy-highlight-end-limit (point-max)) |
| 2386 | isearch-lazy-highlight-start | 2393 | (if isearch-lazy-highlight-wrapped |
| 2387 | (window-end)) | 2394 | isearch-lazy-highlight-start |
| 2388 | (if isearch-lazy-highlight-wrapped | 2395 | (window-end))) |
| 2389 | isearch-lazy-highlight-end | 2396 | (max (or isearch-lazy-highlight-start-limit (point-min)) |
| 2390 | (window-start))) | 2397 | (if isearch-lazy-highlight-wrapped |
| 2398 | isearch-lazy-highlight-end | ||
| 2399 | (window-start)))) | ||
| 2391 | t))) | 2400 | t))) |
| 2392 | 2401 | ||
| 2393 | (defun isearch-lazy-highlight-update () | 2402 | (defun isearch-lazy-highlight-update () |
| @@ -2446,9 +2455,11 @@ Attempt to do the search exactly the way the pending isearch would." | |||
| 2446 | (if isearch-forward | 2455 | (if isearch-forward |
| 2447 | (progn | 2456 | (progn |
| 2448 | (setq isearch-lazy-highlight-end (window-start)) | 2457 | (setq isearch-lazy-highlight-end (window-start)) |
| 2449 | (goto-char (window-start))) | 2458 | (goto-char (max (or isearch-lazy-highlight-start-limit (point-min)) |
| 2459 | (window-start)))) | ||
| 2450 | (setq isearch-lazy-highlight-start (window-end)) | 2460 | (setq isearch-lazy-highlight-start (window-end)) |
| 2451 | (goto-char (window-end))))))) | 2461 | (goto-char (min (or isearch-lazy-highlight-end-limit (point-max)) |
| 2462 | (window-end)))))))) | ||
| 2452 | (unless nomore | 2463 | (unless nomore |
| 2453 | (setq isearch-lazy-highlight-timer | 2464 | (setq isearch-lazy-highlight-timer |
| 2454 | (run-at-time lazy-highlight-interval nil | 2465 | (run-at-time lazy-highlight-interval nil |