Commit e41ae6f1 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

*** empty log message ***

parent 85b2e0ee
......@@ -357,7 +357,43 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden."
(goto-char from)
(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))))
(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))))
(defun hide-entry ()
"Hide the body directly following this heading."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment