Mercurial > hg > xemacs-beta
comparison lisp/isearch-mode.el @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | abe6d1db359e |
children | 7039e6323819 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
178 (defcustom isearch-hide-immediately t | 178 (defcustom isearch-hide-immediately t |
179 "If non-nil, re-hide an invisible match right away. | 179 "If non-nil, re-hide an invisible match right away. |
180 This variable makes a difference when `search-invisible' is set to `open'. | 180 This variable makes a difference when `search-invisible' is set to `open'. |
181 It means that after search makes some invisible text visible | 181 It means that after search makes some invisible text visible |
182 to show the match, it makes the text invisible again when the match moves. | 182 to show the match, it makes the text invisible again when the match moves. |
183 Ordinarily the text becomes invisible again at the end of the search." | 183 Ordinarily the text becomes invisible again at the end of the search." |
184 :type 'boolean | 184 :type 'boolean |
185 :group 'isearch) | 185 :group 'isearch) |
186 | 186 |
187 (defvar isearch-mode-hook nil | 187 (defvar isearch-mode-hook nil |
188 "Function(s) to call after starting up an incremental search.") | 188 "Function(s) to call after starting up an incremental search.") |
189 | 189 |
672 (and (not edit) isearch-recursive-edit (exit-recursive-edit))) | 672 (and (not edit) isearch-recursive-edit (exit-recursive-edit))) |
673 | 673 |
674 (defun isearch-update-ring (string &optional regexp) | 674 (defun isearch-update-ring (string &optional regexp) |
675 "Add STRING to the beginning of the search ring. | 675 "Add STRING to the beginning of the search ring. |
676 REGEXP says which ring to use." | 676 REGEXP says which ring to use." |
677 (if regexp | 677 (if regexp |
678 (if (or (null regexp-search-ring) | 678 (if (or (null regexp-search-ring) |
679 (not (string= string (car regexp-search-ring)))) | 679 (not (string= string (car regexp-search-ring)))) |
680 (progn | 680 (progn |
681 (setq regexp-search-ring | 681 (setq regexp-search-ring |
682 (cons string regexp-search-ring)) | 682 (cons string regexp-search-ring)) |
1720 (put extent 'isearch-invisible (get extent 'invisible)) | 1720 (put extent 'isearch-invisible (get extent 'invisible)) |
1721 (put extent 'isearch-intangible (get extent 'intangible)) | 1721 (put extent 'isearch-intangible (get extent 'intangible)) |
1722 (put extent 'invisible nil) | 1722 (put extent 'invisible nil) |
1723 (put extent 'intangible nil)) | 1723 (put extent 'intangible nil)) |
1724 | 1724 |
1725 (defun isearch-range-invisible (beg end) | 1725 (defun isearch-range-invisible (start end) |
1726 "Return t if all the text from BEG to END is invisible. | 1726 "Return t if all the text from START to END is invisible. |
1727 Before that, if search-invisible is `open', unhide the extents with an | 1727 Before that, if search-invisible is `open', unhide the extents with an |
1728 `isearch-open-invisible' property." | 1728 `isearch-open-invisible' property." |
1729 ;; isearch-search uses this to skip the extents that are invisible, | 1729 ;; isearch-search uses this to skip the extents that are invisible, |
1730 ;; but don't have `isearch-open-invisible' set. It is unclear | 1730 ;; but don't have `isearch-open-invisible' set. It is unclear |
1731 ;; what's supposed to happen if only a part of [BEG, END) overlaps | 1731 ;; what's supposed to happen if only a part of [START, END) overlaps |
1732 ;; the extent. | 1732 ;; the extent. |
1733 (let (to-be-unhidden) | 1733 (let (to-be-unhidden) |
1734 (if (map-extents | 1734 (if (map-extents |
1735 (lambda (extent ignored) | 1735 (lambda (extent ignored) |
1736 (if (and (<= (extent-start-position extent) beg) | 1736 (if (and (<= (extent-start-position extent) start) |
1737 (>= (extent-end-position extent) end)) | 1737 (>= (extent-end-position extent) end)) |
1738 ;; All of the region is covered by the extent. | 1738 ;; All of the region is covered by the extent. |
1739 (if (and (eq search-invisible 'open) | 1739 (if (and (eq search-invisible 'open) |
1740 (get extent 'isearch-open-invisible)) | 1740 (get extent 'isearch-open-invisible)) |
1741 (progn | 1741 (progn |
1745 ;; skip the whole match. We return from map-extents | 1745 ;; skip the whole match. We return from map-extents |
1746 ;; immediately. | 1746 ;; immediately. |
1747 t) | 1747 t) |
1748 ;; Else, keep looking. | 1748 ;; Else, keep looking. |
1749 nil)) | 1749 nil)) |
1750 nil beg end nil 'all-extents-closed 'invisible) | 1750 nil start end nil 'all-extents-closed 'invisible) |
1751 ;; The whole match must be skipped. Signal it by returning t | 1751 ;; The whole match must be skipped. Signal it by returning t |
1752 ;; to the caller. | 1752 ;; to the caller. |
1753 t | 1753 t |
1754 ;; If any extents need to be unhidden, unhide them. | 1754 ;; If any extents need to be unhidden, unhide them. |
1755 (mapc #'isearch-unhide-extent to-be-unhidden) | 1755 (mapc #'isearch-unhide-extent to-be-unhidden) |
1764 (put extent 'intangible (get extent 'isearch-intangible)) | 1764 (put extent 'intangible (get extent 'isearch-intangible)) |
1765 (remprop extent 'isearch-invisible) | 1765 (remprop extent 'isearch-invisible) |
1766 (remprop extent 'isearch-intangible)) | 1766 (remprop extent 'isearch-intangible)) |
1767 | 1767 |
1768 ;; FSF calls this function `isearch-clean-overlays'. | 1768 ;; FSF calls this function `isearch-clean-overlays'. |
1769 (defun isearch-restore-invisible-extents (beg end) | 1769 (defun isearch-restore-invisible-extents (start end) |
1770 (cond | 1770 (cond |
1771 ((null beg) | 1771 ((null start) |
1772 ;; Delete all -- this is called at the end of isearch. | 1772 ;; Delete all -- this is called at the end of isearch. |
1773 (mapc #'isearch-restore-extent isearch-unhidden-extents) | 1773 (mapc #'isearch-restore-extent isearch-unhidden-extents) |
1774 (setq isearch-unhidden-extents nil)) | 1774 (setq isearch-unhidden-extents nil)) |
1775 (t | 1775 (t |
1776 ;; Extents that do not overlap the match area can be safely | 1776 ;; Extents that do not overlap the match area can be safely |
1777 ;; restored to their hidden state. | 1777 ;; restored to their hidden state. |
1778 (setq isearch-unhidden-extents | 1778 (setq isearch-unhidden-extents |
1779 (delete-if (lambda (extent) | 1779 (delete-if (lambda (extent) |
1780 (unless (extent-in-region-p extent beg end | 1780 (unless (extent-in-region-p extent start end |
1781 'all-extents-closed) | 1781 'all-extents-closed) |
1782 (isearch-restore-extent extent) | 1782 (isearch-restore-extent extent) |
1783 t)) | 1783 t)) |
1784 isearch-unhidden-extents))))) | 1784 isearch-unhidden-extents))))) |
1785 | 1785 |