# HG changeset patch # User Juri Linkov # Date 1226882566 0 # Node ID 034bef9118e63045c1ae8274318ac22349c590fb # Parent 0877892a118bb3c60dd5114e8921b6ce5171bad2 (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'. diff -r 0877892a118b -r 034bef9118e6 lisp/isearch.el --- a/lisp/isearch.el Sun Nov 16 23:47:04 2008 +0000 +++ b/lisp/isearch.el Mon Nov 17 00:42:46 2008 +0000 @@ -176,11 +176,12 @@ "Function to save a function restoring the mode-specific isearch state to the search status stack.") -(defvar isearch-success-function 'isearch-success-function-default - "Function to report whether the new search match is considered successful. -The function has two arguments: the positions of start and end of text -matched by the search. If this function returns nil, continue -searching without stopping at this match.") +(defvar isearch-filter-predicate 'isearch-filter-invisible + "Predicate that filters the search hits that would normally be available. +Search hits that dissatisfy the predicate are skipped. The function +has two arguments: the positions of start and end of text matched by +the search. If this function returns nil, continue searching without +stopping at this match.") ;; Search ring. @@ -2257,7 +2258,7 @@ (isearch-no-upper-case-p isearch-string isearch-regexp))) (condition-case lossage (let ((inhibit-point-motion-hooks - (and (eq isearch-success-function 'isearch-success-function-default) + (and (eq isearch-filter-predicate 'isearch-filter-invisible) search-invisible)) (inhibit-quit nil) (case-fold-search isearch-case-fold-search) @@ -2267,12 +2268,12 @@ (while retry (setq isearch-success (isearch-search-string isearch-string nil t)) - ;; Clear RETRY unless we matched some invisible text - ;; and we aren't supposed to do that. + ;; Clear RETRY unless the search predicate says + ;; to skip this search hit. (if (or (not isearch-success) (bobp) (eobp) (= (match-beginning 0) (match-end 0)) - (funcall isearch-success-function + (funcall isearch-filter-predicate (match-beginning 0) (match-end 0))) (setq retry nil))) (setq isearch-just-started nil) @@ -2451,10 +2452,10 @@ nil) (setq isearch-hidden t))))))) -(defun isearch-success-function-default (beg end) - "Default function to report if the new search match is successful. -Returns t if search can match hidden text, or otherwise checks if some -text from BEG to END is visible." +(defun isearch-filter-invisible (beg end) + "Default predicate to filter out invisible text. +It filters search hits to those that are visible (at least partially), +unless invisible text too can be searched." (or (eq search-invisible t) (not (isearch-range-invisible beg end)))) @@ -2640,12 +2641,14 @@ (if isearch-lazy-highlight-wrapped isearch-lazy-highlight-end (window-start)))))) - ;; Use a loop like in `isearch-search' + ;; Use a loop like in `isearch-search'. (while retry (setq success (isearch-search-string isearch-lazy-highlight-last-string bound t)) + ;; Clear RETRY unless the search predicate says + ;; to skip this search hit. (if (or (not success) - (funcall isearch-success-function + (funcall isearch-filter-predicate (match-beginning 0) (match-end 0))) (setq retry nil))) success)