diff options
| author | Richard M. Stallman | 1996-12-14 22:24:35 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-12-14 22:24:35 +0000 |
| commit | 21cd2849ae66494c3fc90483713c373d040587f8 (patch) | |
| tree | ce39cc1f169231e6a31a941be82f880125b0ff2c /lisp | |
| parent | 147f1d2af3230d92fa920f7d64f333336217854a (diff) | |
| download | emacs-21cd2849ae66494c3fc90483713c373d040587f8.tar.gz emacs-21cd2849ae66494c3fc90483713c373d040587f8.zip | |
(outline-discard-overlays):
Use overlays-in, to ensure we get rid of empty overlays.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/textmodes/outline.el | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/lisp/textmodes/outline.el b/lisp/textmodes/outline.el index 02018d2d218..6116c8116da 100644 --- a/lisp/textmodes/outline.el +++ b/lisp/textmodes/outline.el | |||
| @@ -386,25 +386,22 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden." | |||
| 386 | (if (< end beg) | 386 | (if (< end beg) |
| 387 | (setq beg (prog1 end (setq end beg)))) | 387 | (setq beg (prog1 end (setq end beg)))) |
| 388 | (save-excursion | 388 | (save-excursion |
| 389 | (goto-char beg) | 389 | (let ((overlays (overlays-in beg end))) |
| 390 | (while (< (point) end) | 390 | (while overlays |
| 391 | (let ((overlays (overlays-at (point)))) | 391 | (let ((o (car overlays))) |
| 392 | (while overlays | 392 | (if (overlay-get o prop) |
| 393 | (let ((o (car overlays))) | 393 | ;; Either push this overlay outside beg...end |
| 394 | (if (overlay-get o prop) | 394 | ;; or split it to exclude beg...end |
| 395 | ;; Either push this overlay outside beg...end | 395 | ;; or delete it entirely (if it is contained in beg...end). |
| 396 | ;; or split it to exclude beg...end | 396 | (if (< (overlay-start o) beg) |
| 397 | ;; or delete it entirely (if it is contained in beg...end). | ||
| 398 | (if (< (overlay-start o) beg) | ||
| 399 | (if (> (overlay-end o) end) | ||
| 400 | (let ((o1 (outline-copy-overlay o))) | ||
| 401 | (move-overlay o1 (overlay-start o1) beg) | ||
| 402 | (move-overlay o (overlay-start o) beg))) | ||
| 403 | (if (> (overlay-end o) end) | 397 | (if (> (overlay-end o) end) |
| 404 | (move-overlay o end (overlay-end o)) | 398 | (let ((o1 (outline-copy-overlay o))) |
| 405 | (delete-overlay o))))) | 399 | (move-overlay o1 (overlay-start o1) beg) |
| 406 | (setq overlays (cdr overlays)))) | 400 | (move-overlay o (overlay-start o) beg))) |
| 407 | (goto-char (next-overlay-change (point)))))) | 401 | (if (> (overlay-end o) end) |
| 402 | (move-overlay o end (overlay-end o)) | ||
| 403 | (delete-overlay o))))) | ||
| 404 | (setq overlays (cdr overlays)))))) | ||
| 408 | 405 | ||
| 409 | ;; Make a copy of overlay O, with the same beginning, end and properties. | 406 | ;; Make a copy of overlay O, with the same beginning, end and properties. |
| 410 | (defun outline-copy-overlay (o) | 407 | (defun outline-copy-overlay (o) |