diff options
| author | Juri Linkov | 2008-11-17 00:42:46 +0000 |
|---|---|---|
| committer | Juri Linkov | 2008-11-17 00:42:46 +0000 |
| commit | 2f669fac39f041385f25af286f863234f72a8ae4 (patch) | |
| tree | 30213d398cd8b3dfe2dbae056cd829ef60e0333b | |
| parent | ff757fd1df2478b70e6a902b64a797d14c320eb1 (diff) | |
| download | emacs-2f669fac39f041385f25af286f863234f72a8ae4.tar.gz emacs-2f669fac39f041385f25af286f863234f72a8ae4.zip | |
(isearch-filter-predicate): Rename from
`isearch-success-function'. Rename default value from
`isearch-success-function-default' to
`isearch-filter-invisible'. Doc fix.
(isearch-filter-invisible): Rename from
`isearch-success-function-default'. Doc fix.
(isearch-search, isearch-lazy-highlight-search): Rename
`isearch-success-function' to `isearch-filter-predicate'.
| -rw-r--r-- | lisp/isearch.el | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index c3434727677..75839e9931c 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -176,11 +176,12 @@ or to the end of the buffer for a backward search.") | |||
| 176 | "Function to save a function restoring the mode-specific isearch state | 176 | "Function to save a function restoring the mode-specific isearch state |
| 177 | to the search status stack.") | 177 | to the search status stack.") |
| 178 | 178 | ||
| 179 | (defvar isearch-success-function 'isearch-success-function-default | 179 | (defvar isearch-filter-predicate 'isearch-filter-invisible |
| 180 | "Function to report whether the new search match is considered successful. | 180 | "Predicate that filters the search hits that would normally be available. |
| 181 | The function has two arguments: the positions of start and end of text | 181 | Search hits that dissatisfy the predicate are skipped. The function |
| 182 | matched by the search. If this function returns nil, continue | 182 | has two arguments: the positions of start and end of text matched by |
| 183 | searching without stopping at this match.") | 183 | the search. If this function returns nil, continue searching without |
| 184 | stopping at this match.") | ||
| 184 | 185 | ||
| 185 | ;; Search ring. | 186 | ;; Search ring. |
| 186 | 187 | ||
| @@ -2257,7 +2258,7 @@ Can be changed via `isearch-search-fun-function' for special needs." | |||
| 2257 | (isearch-no-upper-case-p isearch-string isearch-regexp))) | 2258 | (isearch-no-upper-case-p isearch-string isearch-regexp))) |
| 2258 | (condition-case lossage | 2259 | (condition-case lossage |
| 2259 | (let ((inhibit-point-motion-hooks | 2260 | (let ((inhibit-point-motion-hooks |
| 2260 | (and (eq isearch-success-function 'isearch-success-function-default) | 2261 | (and (eq isearch-filter-predicate 'isearch-filter-invisible) |
| 2261 | search-invisible)) | 2262 | search-invisible)) |
| 2262 | (inhibit-quit nil) | 2263 | (inhibit-quit nil) |
| 2263 | (case-fold-search isearch-case-fold-search) | 2264 | (case-fold-search isearch-case-fold-search) |
| @@ -2267,12 +2268,12 @@ Can be changed via `isearch-search-fun-function' for special needs." | |||
| 2267 | (while retry | 2268 | (while retry |
| 2268 | (setq isearch-success | 2269 | (setq isearch-success |
| 2269 | (isearch-search-string isearch-string nil t)) | 2270 | (isearch-search-string isearch-string nil t)) |
| 2270 | ;; Clear RETRY unless we matched some invisible text | 2271 | ;; Clear RETRY unless the search predicate says |
| 2271 | ;; and we aren't supposed to do that. | 2272 | ;; to skip this search hit. |
| 2272 | (if (or (not isearch-success) | 2273 | (if (or (not isearch-success) |
| 2273 | (bobp) (eobp) | 2274 | (bobp) (eobp) |
| 2274 | (= (match-beginning 0) (match-end 0)) | 2275 | (= (match-beginning 0) (match-end 0)) |
| 2275 | (funcall isearch-success-function | 2276 | (funcall isearch-filter-predicate |
| 2276 | (match-beginning 0) (match-end 0))) | 2277 | (match-beginning 0) (match-end 0))) |
| 2277 | (setq retry nil))) | 2278 | (setq retry nil))) |
| 2278 | (setq isearch-just-started nil) | 2279 | (setq isearch-just-started nil) |
| @@ -2451,10 +2452,10 @@ Can be changed via `isearch-search-fun-function' for special needs." | |||
| 2451 | nil) | 2452 | nil) |
| 2452 | (setq isearch-hidden t))))))) | 2453 | (setq isearch-hidden t))))))) |
| 2453 | 2454 | ||
| 2454 | (defun isearch-success-function-default (beg end) | 2455 | (defun isearch-filter-invisible (beg end) |
| 2455 | "Default function to report if the new search match is successful. | 2456 | "Default predicate to filter out invisible text. |
| 2456 | Returns t if search can match hidden text, or otherwise checks if some | 2457 | It filters search hits to those that are visible (at least partially), |
| 2457 | text from BEG to END is visible." | 2458 | unless invisible text too can be searched." |
| 2458 | (or (eq search-invisible t) | 2459 | (or (eq search-invisible t) |
| 2459 | (not (isearch-range-invisible beg end)))) | 2460 | (not (isearch-range-invisible beg end)))) |
| 2460 | 2461 | ||
| @@ -2640,12 +2641,14 @@ Attempt to do the search exactly the way the pending isearch would." | |||
| 2640 | (if isearch-lazy-highlight-wrapped | 2641 | (if isearch-lazy-highlight-wrapped |
| 2641 | isearch-lazy-highlight-end | 2642 | isearch-lazy-highlight-end |
| 2642 | (window-start)))))) | 2643 | (window-start)))))) |
| 2643 | ;; Use a loop like in `isearch-search' | 2644 | ;; Use a loop like in `isearch-search'. |
| 2644 | (while retry | 2645 | (while retry |
| 2645 | (setq success (isearch-search-string | 2646 | (setq success (isearch-search-string |
| 2646 | isearch-lazy-highlight-last-string bound t)) | 2647 | isearch-lazy-highlight-last-string bound t)) |
| 2648 | ;; Clear RETRY unless the search predicate says | ||
| 2649 | ;; to skip this search hit. | ||
| 2647 | (if (or (not success) | 2650 | (if (or (not success) |
| 2648 | (funcall isearch-success-function | 2651 | (funcall isearch-filter-predicate |
| 2649 | (match-beginning 0) (match-end 0))) | 2652 | (match-beginning 0) (match-end 0))) |
| 2650 | (setq retry nil))) | 2653 | (setq retry nil))) |
| 2651 | success) | 2654 | success) |