diff --git a/lisp/info.el b/lisp/info.el index ab83b45a2a7..4e14b264ef0 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -1625,20 +1625,8 @@ If DIRECTION is `backward', search in the reverse direction." (1- (point))) (point-max))) (while (and (not give-up) - (save-match-data - (or (null found) - (if backward - (isearch-range-invisible found beg-found) - (isearch-range-invisible beg-found found)) - ;; Skip node header line - (and (save-excursion (forward-line -1) - (looking-at "\^_")) - (forward-line (if backward -1 1))) - ;; Skip Tag Table node - (save-excursion - (and (search-backward "\^_" nil t) - (looking-at - "\^_\n\\(Tag Table\\|Local Variables\\)")))))) + (or (null found) + (not (funcall isearch-success-function beg-found found)))) (let ((search-spaces-regexp (if (or (not isearch-mode) isearch-regexp) Info-search-whitespace-regexp))) @@ -1717,20 +1705,8 @@ If DIRECTION is `backward', search in the reverse direction." (setq list (cdr list)) (setq give-up nil found nil) (while (and (not give-up) - (save-match-data - (or (null found) - (if backward - (isearch-range-invisible found beg-found) - (isearch-range-invisible beg-found found)) - ;; Skip node header line - (and (save-excursion (forward-line -1) - (looking-at "\^_")) - (forward-line (if backward -1 1))) - ;; Skip Tag Table node - (save-excursion - (and (search-backward "\^_" nil t) - (looking-at - "\^_\n\\(Tag Table\\|Local Variables\\)")))))) + (or (null found) + (not (funcall isearch-success-function beg-found found)))) (let ((search-spaces-regexp (if (or (not isearch-mode) isearch-regexp) Info-search-whitespace-regexp))) @@ -1836,6 +1812,28 @@ If DIRECTION is `backward', search in the reverse direction." (defun Info-isearch-start () (setq Info-isearch-initial-node nil)) + +(defun Info-search-success-function (beg-found found) + "Skip invisible text, node header line and Tag Table node." + (save-match-data + (let ((backward (< found beg-found))) + (not + (or + (if backward + (or (text-property-not-all found beg-found 'invisible nil) + (text-property-not-all found beg-found 'display nil)) + (or (text-property-not-all beg-found found 'invisible nil) + (text-property-not-all beg-found found 'display nil))) + ;; Skip node header line + (and (save-excursion (forward-line -1) + (looking-at "\^_")) + (forward-line (if backward -1 1))) + ;; Skip Tag Table node + (save-excursion + (and (search-backward "\^_" nil t) + (looking-at + "\^_\n\\(Tag Table\\|Local Variables\\)")))))))) + (defun Info-extract-pointer (name &optional errorname) "Extract the value of the node-pointer named NAME. @@ -3458,6 +3456,8 @@ Advanced commands: 'Info-isearch-wrap) (set (make-local-variable 'isearch-push-state-function) 'Info-isearch-push-state) + (set (make-local-variable 'isearch-success-function) + 'Info-search-success-function) (set (make-local-variable 'search-whitespace-regexp) Info-search-whitespace-regexp) (set (make-local-variable 'revert-buffer-function)