changeset 10996:356f658dbd65

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Tue, 14 Mar 1995 00:33:40 +0000
parents 842974f9ab7d
children 66d853abce42
files lisp/textmodes/outline.el
diffstat 1 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/outline.el	Mon Mar 13 23:12:41 1995 +0000
+++ b/lisp/textmodes/outline.el	Tue Mar 14 00:33:40 1995 +0000
@@ -357,7 +357,43 @@
     (save-excursion
       (goto-char from)
       (end-of-line)
-      (put-text-property (point) to 'invisible flag))))
+      (outline-discard-overlays (point) to 'outline)
+      (if flag
+	  (let ((o (make-overlay (point) to)))
+	    (overlay-put o 'invisible flag)
+	    (overlay-put o 'outline t))))))
+
+(defun outline-discard-overlays (beg end prop)
+  (if (< end beg)
+      (setq beg (prog1 end (setq end beg))))
+  (save-excursion
+    (goto-char beg)
+    (while (< (point) end)
+      (let ((overlays (overlays-at (point))))
+	(while overlays
+	  (let ((o (car overlays)))
+	    (if (overlay-get o prop)
+		;; Either push this overlay outside beg...end
+		;; or split it to exclude beg...end
+		;; or delete it entirely (if it is contained in beg...end).
+		(if (< (overlay-start o) beg)
+		    (if (> (overlay-end o) end)
+			(let ((o1 (outline-copy-overlay o)))
+			  (move-overlay o1 (overlay-start o1) beg)
+		      (move-overlay o (overlay-start o) beg)))
+		  (if (> (overlay-end o) end)
+		      (move-overlay o end (overlay-end o))
+		    (delete-overlay o)))))
+	  (setq overlays (cdr overlays))))
+      (goto-char (next-overlay-change (point))))))
+
+(defun outline-copy-overlay (o)
+  (let ((o1 (make-overlay (overlay-start o) (overlay-end o)))
+	(props (overlay-properties o)))
+    (while props
+      (overlay-put o1 (car props) (nth 1 props))
+      (setq props (cdr (cdr props))))
+    o1))
 
 (defun hide-entry ()
   "Hide the body directly following this heading."