diff options
| author | Juri Linkov | 2008-04-22 19:57:58 +0000 |
|---|---|---|
| committer | Juri Linkov | 2008-04-22 19:57:58 +0000 |
| commit | 0ec3382b012291ce7c882c88ed12e132243fc794 (patch) | |
| tree | 4c5859bcf2f4685563f4a6f6a72020820306471e | |
| parent | 5e189f398c737704f37979cff6cd2c768e9a7c36 (diff) | |
| download | emacs-0ec3382b012291ce7c882c88ed12e132243fc794.tar.gz emacs-0ec3382b012291ce7c882c88ed12e132243fc794.zip | |
(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.
| -rw-r--r-- | lisp/info.el | 56 |
1 files changed, 28 insertions, 28 deletions
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." | |||
| 1625 | (1- (point))) | 1625 | (1- (point))) |
| 1626 | (point-max))) | 1626 | (point-max))) |
| 1627 | (while (and (not give-up) | 1627 | (while (and (not give-up) |
| 1628 | (save-match-data | 1628 | (or (null found) |
| 1629 | (or (null found) | 1629 | (not (funcall isearch-success-function beg-found found)))) |
| 1630 | (if backward | ||
| 1631 | (isearch-range-invisible found beg-found) | ||
| 1632 | (isearch-range-invisible beg-found found)) | ||
| 1633 | ;; Skip node header line | ||
| 1634 | (and (save-excursion (forward-line -1) | ||
| 1635 | (looking-at "\^_")) | ||
| 1636 | (forward-line (if backward -1 1))) | ||
| 1637 | ;; Skip Tag Table node | ||
| 1638 | (save-excursion | ||
| 1639 | (and (search-backward "\^_" nil t) | ||
| 1640 | (looking-at | ||
| 1641 | "\^_\n\\(Tag Table\\|Local Variables\\)")))))) | ||
| 1642 | (let ((search-spaces-regexp | 1630 | (let ((search-spaces-regexp |
| 1643 | (if (or (not isearch-mode) isearch-regexp) | 1631 | (if (or (not isearch-mode) isearch-regexp) |
| 1644 | Info-search-whitespace-regexp))) | 1632 | Info-search-whitespace-regexp))) |
| @@ -1717,20 +1705,8 @@ If DIRECTION is `backward', search in the reverse direction." | |||
| 1717 | (setq list (cdr list)) | 1705 | (setq list (cdr list)) |
| 1718 | (setq give-up nil found nil) | 1706 | (setq give-up nil found nil) |
| 1719 | (while (and (not give-up) | 1707 | (while (and (not give-up) |
| 1720 | (save-match-data | 1708 | (or (null found) |
| 1721 | (or (null found) | 1709 | (not (funcall isearch-success-function beg-found found)))) |
| 1722 | (if backward | ||
| 1723 | (isearch-range-invisible found beg-found) | ||
| 1724 | (isearch-range-invisible beg-found found)) | ||
| 1725 | ;; Skip node header line | ||
| 1726 | (and (save-excursion (forward-line -1) | ||
| 1727 | (looking-at "\^_")) | ||
| 1728 | (forward-line (if backward -1 1))) | ||
| 1729 | ;; Skip Tag Table node | ||
| 1730 | (save-excursion | ||
| 1731 | (and (search-backward "\^_" nil t) | ||
| 1732 | (looking-at | ||
| 1733 | "\^_\n\\(Tag Table\\|Local Variables\\)")))))) | ||
| 1734 | (let ((search-spaces-regexp | 1710 | (let ((search-spaces-regexp |
| 1735 | (if (or (not isearch-mode) isearch-regexp) | 1711 | (if (or (not isearch-mode) isearch-regexp) |
| 1736 | Info-search-whitespace-regexp))) | 1712 | Info-search-whitespace-regexp))) |
| @@ -1836,6 +1812,28 @@ If DIRECTION is `backward', search in the reverse direction." | |||
| 1836 | 1812 | ||
| 1837 | (defun Info-isearch-start () | 1813 | (defun Info-isearch-start () |
| 1838 | (setq Info-isearch-initial-node nil)) | 1814 | (setq Info-isearch-initial-node nil)) |
| 1815 | |||
| 1816 | (defun Info-search-success-function (beg-found found) | ||
| 1817 | "Skip invisible text, node header line and Tag Table node." | ||
| 1818 | (save-match-data | ||
| 1819 | (let ((backward (< found beg-found))) | ||
| 1820 | (not | ||
| 1821 | (or | ||
| 1822 | (if backward | ||
| 1823 | (or (text-property-not-all found beg-found 'invisible nil) | ||
| 1824 | (text-property-not-all found beg-found 'display nil)) | ||
| 1825 | (or (text-property-not-all beg-found found 'invisible nil) | ||
| 1826 | (text-property-not-all beg-found found 'display nil))) | ||
| 1827 | ;; Skip node header line | ||
| 1828 | (and (save-excursion (forward-line -1) | ||
| 1829 | (looking-at "\^_")) | ||
| 1830 | (forward-line (if backward -1 1))) | ||
| 1831 | ;; Skip Tag Table node | ||
| 1832 | (save-excursion | ||
| 1833 | (and (search-backward "\^_" nil t) | ||
| 1834 | (looking-at | ||
| 1835 | "\^_\n\\(Tag Table\\|Local Variables\\)")))))))) | ||
| 1836 | |||
| 1839 | 1837 | ||
| 1840 | (defun Info-extract-pointer (name &optional errorname) | 1838 | (defun Info-extract-pointer (name &optional errorname) |
| 1841 | "Extract the value of the node-pointer named NAME. | 1839 | "Extract the value of the node-pointer named NAME. |
| @@ -3458,6 +3456,8 @@ Advanced commands: | |||
| 3458 | 'Info-isearch-wrap) | 3456 | 'Info-isearch-wrap) |
| 3459 | (set (make-local-variable 'isearch-push-state-function) | 3457 | (set (make-local-variable 'isearch-push-state-function) |
| 3460 | 'Info-isearch-push-state) | 3458 | 'Info-isearch-push-state) |
| 3459 | (set (make-local-variable 'isearch-success-function) | ||
| 3460 | 'Info-search-success-function) | ||
| 3461 | (set (make-local-variable 'search-whitespace-regexp) | 3461 | (set (make-local-variable 'search-whitespace-regexp) |
| 3462 | Info-search-whitespace-regexp) | 3462 | Info-search-whitespace-regexp) |
| 3463 | (set (make-local-variable 'revert-buffer-function) | 3463 | (set (make-local-variable 'revert-buffer-function) |