diff options
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/isearch.el | 51 |
2 files changed, 33 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cf718738e66..dc4b8e4f202 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2001-09-07 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * isearch.el (isearch-intersects-p): New function. | ||
| 4 | (isearch-close-unnecessary-overlays): Renamed from *unecessary*, | ||
| 5 | use isearch-intersects-p, and clean up. | ||
| 6 | |||
| 1 | 2001-09-07 Eli Zaretskii <eliz@is.elta.co.il> | 7 | 2001-09-07 Eli Zaretskii <eliz@is.elta.co.il> |
| 2 | 8 | ||
| 3 | * textmodes/ispell.el (ispell-dictionary-alist-4): Add "german" | 9 | * textmodes/ispell.el (ispell-dictionary-alist-4): Add "german" |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 2392bf2935b..a125f7ab053 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -1680,32 +1680,35 @@ If there is no completion possible, say so and continue searching." | |||
| 1680 | (mapc 'isearch-open-necessary-overlays isearch-opened-overlays) | 1680 | (mapc 'isearch-open-necessary-overlays isearch-opened-overlays) |
| 1681 | (setq isearch-opened-overlays nil))) | 1681 | (setq isearch-opened-overlays nil))) |
| 1682 | 1682 | ||
| 1683 | |||
| 1684 | (defun isearch-intersects-p (start0 end0 start1 end1) | ||
| 1685 | "Return t if regions START0..END0 and START1..END1 intersect." | ||
| 1686 | (or (and (>= start0 start1) (< start0 end1)) | ||
| 1687 | (and (>= end0 start1) (< end0 end1)) | ||
| 1688 | (and (>= start1 start0) (< start1 end0)) | ||
| 1689 | (and (>= end1 start0) (< end1 end0)))) | ||
| 1690 | |||
| 1691 | |||
| 1683 | ;;; Verify if the current match is outside of each element of | 1692 | ;;; Verify if the current match is outside of each element of |
| 1684 | ;;; `isearch-opened-overlays', if so close that overlay. | 1693 | ;;; `isearch-opened-overlays', if so close that overlay. |
| 1685 | (defun isearch-close-unecessary-overlays (begin end) | 1694 | |
| 1686 | (let ((ov-list isearch-opened-overlays) | 1695 | (defun isearch-close-unnecessary-overlays (begin end) |
| 1687 | ov | 1696 | (let ((overlays isearch-opened-overlays)) |
| 1688 | inside-overlay | ||
| 1689 | fct-temp) | ||
| 1690 | (setq isearch-opened-overlays nil) | 1697 | (setq isearch-opened-overlays nil) |
| 1691 | (while ov-list | 1698 | (dolist (ov overlays) |
| 1692 | (setq ov (car ov-list)) | 1699 | (if (isearch-intersects-p begin end (overlay-start ov) (overlay-end ov)) |
| 1693 | (setq ov-list (cdr ov-list)) | 1700 | (push ov isearch-opened-overlays) |
| 1694 | (setq inside-overlay (or (and (> begin (overlay-start ov)) | 1701 | (let ((fct-temp (overlay-get ov 'isearch-open-invisible-temporary))) |
| 1695 | (< begin (overlay-end ov))) | 1702 | (if fct-temp |
| 1696 | (and (> end (overlay-start ov)) | 1703 | ;; If this exists it means that the overlay was opened |
| 1697 | (< end (overlay-end ov))))) | 1704 | ;; using this function, not by us tweaking the overlay |
| 1698 | ;; If this exists it means that the overlay was opened using | 1705 | ;; properties. |
| 1699 | ;; this function, not by us tweaking the overlay properties. | 1706 | (funcall fct-temp ov t) |
| 1700 | (setq fct-temp (overlay-get ov 'isearch-open-invisible-temporary)) | 1707 | (overlay-put ov 'invisible (overlay-get ov 'isearch-invisible)) |
| 1701 | (if inside-overlay | 1708 | (overlay-put ov 'intangible (overlay-get ov 'isearch-intangible)) |
| 1702 | (setq isearch-opened-overlays (cons ov isearch-opened-overlays)) | 1709 | (overlay-put ov 'isearch-invisible nil) |
| 1703 | (if fct-temp | 1710 | (overlay-put ov 'isearch-intangible nil))))))) |
| 1704 | (funcall fct-temp ov t) | 1711 | |
| 1705 | (overlay-put ov 'invisible (overlay-get ov 'isearch-invisible)) | ||
| 1706 | (overlay-put ov 'intangible (overlay-get ov 'isearch-intangible)) | ||
| 1707 | (overlay-put ov 'isearch-invisible nil) | ||
| 1708 | (overlay-put ov 'isearch-intangible nil)))))) | ||
| 1709 | 1712 | ||
| 1710 | (defun isearch-range-invisible (beg end) | 1713 | (defun isearch-range-invisible (beg end) |
| 1711 | "Return t if all the text from BEG to END is invisible." | 1714 | "Return t if all the text from BEG to END is invisible." |
| @@ -1719,7 +1722,7 @@ If there is no completion possible, say so and continue searching." | |||
| 1719 | ;; the list of overlays that could be opened | 1722 | ;; the list of overlays that could be opened |
| 1720 | (crt-overlays nil)) | 1723 | (crt-overlays nil)) |
| 1721 | (when (and can-be-opened isearch-hide-immediately) | 1724 | (when (and can-be-opened isearch-hide-immediately) |
| 1722 | (isearch-close-unecessary-overlays beg end)) | 1725 | (isearch-close-unnecessary-overlays beg end)) |
| 1723 | ;; If the following character is currently invisible, | 1726 | ;; If the following character is currently invisible, |
| 1724 | ;; skip all characters with that same `invisible' property value. | 1727 | ;; skip all characters with that same `invisible' property value. |
| 1725 | ;; Do that over and over. | 1728 | ;; Do that over and over. |