diff options
author | Juri Linkov <juri@jurta.org> | 2008-11-11 19:57:04 +0000 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2008-11-11 19:57:04 +0000 |
commit | 83659220290b6078d97844a1fd4bd2e874265502 (patch) | |
tree | 73353de2b618ba000bc9d7ebd28dd97e45ac1363 /lisp | |
parent | 8d32ed64169cd4d63c1616af1e8883f7540be14a (diff) | |
download | emacs-83659220290b6078d97844a1fd4bd2e874265502.tar.gz |
* 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.
Diffstat (limited to 'lisp')
-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." (defun isearch-lazy-highlight-search () "Search ahead for the next or previous match, for lazy highlighting. Attempt to do the search exactly the way the pending isearch would." - (let ((case-fold-search isearch-lazy-highlight-case-fold-search) - (isearch-regexp isearch-lazy-highlight-regexp) - (search-spaces-regexp isearch-lazy-highlight-space-regexp)) - (condition-case nil - (isearch-search-string - isearch-lazy-highlight-last-string - (if isearch-forward - (min (or isearch-lazy-highlight-end-limit (point-max)) + (condition-case nil + (let ((case-fold-search isearch-lazy-highlight-case-fold-search) + (isearch-regexp isearch-lazy-highlight-regexp) + (search-spaces-regexp isearch-lazy-highlight-space-regexp) + (search-invisible nil) ; don't match invisible text + (retry t) + (success nil) + (bound (if isearch-forward + (min (or isearch-lazy-highlight-end-limit (point-max)) + (if isearch-lazy-highlight-wrapped + isearch-lazy-highlight-start + (window-end))) + (max (or isearch-lazy-highlight-start-limit (point-min)) (if isearch-lazy-highlight-wrapped - isearch-lazy-highlight-start - (window-end))) - (max (or isearch-lazy-highlight-start-limit (point-min)) - (if isearch-lazy-highlight-wrapped - isearch-lazy-highlight-end - (window-start)))) - t) - (error nil)))) + isearch-lazy-highlight-end + (window-start)))))) + ;; Use a loop like in `isearch-search' + (while retry + (setq success (isearch-search-string + isearch-lazy-highlight-last-string bound t)) + (if (or (not success) + (funcall isearch-success-function + (match-beginning 0) (match-end 0))) + (setq retry nil))) + success) + (error nil))) (defun isearch-lazy-highlight-update () "Update highlighting of other matches for current search." |