diff options
| author | Richard M. Stallman | 1995-03-14 00:33:40 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-03-14 00:33:40 +0000 |
| commit | e41ae6f1279501f08e1031005e7c8666dd8231ae (patch) | |
| tree | d723333f7149d0acc8f8dbd505a53c18ff5b4b61 | |
| parent | 85b2e0ee8874a5c770f506f1aef89d589d83e2ac (diff) | |
| download | emacs-e41ae6f1279501f08e1031005e7c8666dd8231ae.tar.gz emacs-e41ae6f1279501f08e1031005e7c8666dd8231ae.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/textmodes/outline.el | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/lisp/textmodes/outline.el b/lisp/textmodes/outline.el index d56df6a1ff6..47194a1c52d 100644 --- a/lisp/textmodes/outline.el +++ b/lisp/textmodes/outline.el | |||
| @@ -357,7 +357,43 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden." | |||
| 357 | (save-excursion | 357 | (save-excursion |
| 358 | (goto-char from) | 358 | (goto-char from) |
| 359 | (end-of-line) | 359 | (end-of-line) |
| 360 | (put-text-property (point) to 'invisible flag)))) | 360 | (outline-discard-overlays (point) to 'outline) |
| 361 | (if flag | ||
| 362 | (let ((o (make-overlay (point) to))) | ||
| 363 | (overlay-put o 'invisible flag) | ||
| 364 | (overlay-put o 'outline t)))))) | ||
| 365 | |||
| 366 | (defun outline-discard-overlays (beg end prop) | ||
| 367 | (if (< end beg) | ||
| 368 | (setq beg (prog1 end (setq end beg)))) | ||
| 369 | (save-excursion | ||
| 370 | (goto-char beg) | ||
| 371 | (while (< (point) end) | ||
| 372 | (let ((overlays (overlays-at (point)))) | ||
| 373 | (while overlays | ||
| 374 | (let ((o (car overlays))) | ||
| 375 | (if (overlay-get o prop) | ||
| 376 | ;; Either push this overlay outside beg...end | ||
| 377 | ;; or split it to exclude beg...end | ||
| 378 | ;; or delete it entirely (if it is contained in beg...end). | ||
| 379 | (if (< (overlay-start o) beg) | ||
| 380 | (if (> (overlay-end o) end) | ||
| 381 | (let ((o1 (outline-copy-overlay o))) | ||
| 382 | (move-overlay o1 (overlay-start o1) beg) | ||
| 383 | (move-overlay o (overlay-start o) beg))) | ||
| 384 | (if (> (overlay-end o) end) | ||
| 385 | (move-overlay o end (overlay-end o)) | ||
| 386 | (delete-overlay o))))) | ||
| 387 | (setq overlays (cdr overlays)))) | ||
| 388 | (goto-char (next-overlay-change (point)))))) | ||
| 389 | |||
| 390 | (defun outline-copy-overlay (o) | ||
| 391 | (let ((o1 (make-overlay (overlay-start o) (overlay-end o))) | ||
| 392 | (props (overlay-properties o))) | ||
| 393 | (while props | ||
| 394 | (overlay-put o1 (car props) (nth 1 props)) | ||
| 395 | (setq props (cdr (cdr props)))) | ||
| 396 | o1)) | ||
| 361 | 397 | ||
| 362 | (defun hide-entry () | 398 | (defun hide-entry () |
| 363 | "Hide the body directly following this heading." | 399 | "Hide the body directly following this heading." |