Function: outline--hidden-headings-paths
outline--hidden-headings-paths is a byte-compiled function defined in
outline.el.gz.
Signature
(outline--hidden-headings-paths)
Documentation
Return a hash with headings of currently hidden outlines.
Every hash key is a list whose elements compose a complete path of headings descending from the top level down to the bottom level. This is useful to save the hidden outlines and restore them later after reverting the buffer. Also return the outline where point was located before reverting the buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/outline.el.gz
(defun outline--hidden-headings-paths ()
"Return a hash with headings of currently hidden outlines.
Every hash key is a list whose elements compose a complete path
of headings descending from the top level down to the bottom level.
This is useful to save the hidden outlines and restore them later
after reverting the buffer. Also return the outline where point
was located before reverting the buffer."
(let* ((paths (make-hash-table :test #'equal))
path current-path
(current-heading-p (outline-on-heading-p))
(current-beg (when current-heading-p (pos-bol)))
(current-end (when current-heading-p (pos-eol))))
(outline-map-region
(lambda ()
(let* ((level (funcall outline-level))
(heading (buffer-substring-no-properties (pos-bol) (pos-eol))))
(while (and path (>= (cdar path) level))
(pop path))
(push (cons heading level) path)
(when (save-excursion
(outline-end-of-heading)
(seq-some (lambda (o) (eq (overlay-get o 'invisible)
'outline))
(overlays-at (point))))
(setf (gethash (mapcar #'car path) paths) t))
(when (and current-heading-p (<= current-beg (point) current-end))
(setq current-path (mapcar #'car path)))))
(point-min) (point-max))
(list paths current-path)))