(Info-search): In two similar places that skip

undesired search matches move code to Info-search-success-function,
and call `isearch-success-function' instead.
(Info-search-success-function): New function copied from code
in Info-search.  Replace isearch-range-invisible with
text-property-not-all that checks for 'invisible and 'display
properties to skip partially invisible matches (whose display
properties were set by Info-fontify-node).
(Info-mode): Set buffer-local isearch-success-function
to Info-search-success-function.
This commit is contained in:
Juri Linkov 2008-04-22 19:57:58 +00:00
parent 5e189f398c
commit 0ec3382b01

View file

@ -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)