diff options
| author | Juri Linkov | 2008-11-11 19:57:04 +0000 |
|---|---|---|
| committer | Juri Linkov | 2008-11-11 19:57:04 +0000 |
| commit | 83659220290b6078d97844a1fd4bd2e874265502 (patch) | |
| tree | 73353de2b618ba000bc9d7ebd28dd97e45ac1363 | |
| parent | 8d32ed64169cd4d63c1616af1e8883f7540be14a (diff) | |
| download | emacs-83659220290b6078d97844a1fd4bd2e874265502.tar.gz emacs-83659220290b6078d97844a1fd4bd2e874265502.zip | |
* isearch.el (isearch-lazy-highlight-search): Use a loop like in
`isearch-search'. Call isearch-success-function to skip matches
outside the current isearch scope. Let-bind search-invisible to
nil to not match invisible text.
| -rw-r--r-- | lisp/isearch.el | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 8ec21750e25..cf51d44a0f8 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -2619,23 +2619,32 @@ by other Emacs features." | |||
| 2619 | (defun isearch-lazy-highlight-search () | 2619 | (defun isearch-lazy-highlight-search () |
| 2620 | "Search ahead for the next or previous match, for lazy highlighting. | 2620 | "Search ahead for the next or previous match, for lazy highlighting. |
| 2621 | Attempt to do the search exactly the way the pending isearch would." | 2621 | Attempt to do the search exactly the way the pending isearch would." |
| 2622 | (let ((case-fold-search isearch-lazy-highlight-case-fold-search) | 2622 | (condition-case nil |
| 2623 | (isearch-regexp isearch-lazy-highlight-regexp) | 2623 | (let ((case-fold-search isearch-lazy-highlight-case-fold-search) |
| 2624 | (search-spaces-regexp isearch-lazy-highlight-space-regexp)) | 2624 | (isearch-regexp isearch-lazy-highlight-regexp) |
| 2625 | (condition-case nil | 2625 | (search-spaces-regexp isearch-lazy-highlight-space-regexp) |
| 2626 | (isearch-search-string | 2626 | (search-invisible nil) ; don't match invisible text |
| 2627 | isearch-lazy-highlight-last-string | 2627 | (retry t) |
| 2628 | (if isearch-forward | 2628 | (success nil) |
| 2629 | (min (or isearch-lazy-highlight-end-limit (point-max)) | 2629 | (bound (if isearch-forward |
| 2630 | (min (or isearch-lazy-highlight-end-limit (point-max)) | ||
| 2631 | (if isearch-lazy-highlight-wrapped | ||
| 2632 | isearch-lazy-highlight-start | ||
| 2633 | (window-end))) | ||
| 2634 | (max (or isearch-lazy-highlight-start-limit (point-min)) | ||
| 2630 | (if isearch-lazy-highlight-wrapped | 2635 | (if isearch-lazy-highlight-wrapped |
| 2631 | isearch-lazy-highlight-start | 2636 | isearch-lazy-highlight-end |
| 2632 | (window-end))) | 2637 | (window-start)))))) |
| 2633 | (max (or isearch-lazy-highlight-start-limit (point-min)) | 2638 | ;; Use a loop like in `isearch-search' |
| 2634 | (if isearch-lazy-highlight-wrapped | 2639 | (while retry |
| 2635 | isearch-lazy-highlight-end | 2640 | (setq success (isearch-search-string |
| 2636 | (window-start)))) | 2641 | isearch-lazy-highlight-last-string bound t)) |
| 2637 | t) | 2642 | (if (or (not success) |
| 2638 | (error nil)))) | 2643 | (funcall isearch-success-function |
| 2644 | (match-beginning 0) (match-end 0))) | ||
| 2645 | (setq retry nil))) | ||
| 2646 | success) | ||
| 2647 | (error nil))) | ||
| 2639 | 2648 | ||
| 2640 | (defun isearch-lazy-highlight-update () | 2649 | (defun isearch-lazy-highlight-update () |
| 2641 | "Update highlighting of other matches for current search." | 2650 | "Update highlighting of other matches for current search." |