Function: outline--hidden-headings-restore-paths

outline--hidden-headings-restore-paths is a byte-compiled function defined in outline.el.gz.

Signature

(outline--hidden-headings-restore-paths PATHS CURRENT-PATH)

Documentation

Restore hidden outlines from a hash-table of hidden headings.

This is useful after reverting the buffer to restore the outlines hidden by outline--hidden-headings-paths. Also restore point on the same outline where point was before reverting the buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/outline.el.gz
(defun outline--hidden-headings-restore-paths (paths current-path)
  "Restore hidden outlines from a hash-table of hidden headings.
This is useful after reverting the buffer to restore the outlines
hidden by `outline--hidden-headings-paths'.  Also restore point
on the same outline where point was before reverting the buffer."
  (let ((hidelevel nil) (hidestart nil)
        path current-point outline-view-change-hook)
    (outline-map-region
     (lambda ()
       (let ((level (funcall outline-level)))
         (if (and (numberp hidelevel) (<= hidelevel level))
             nil
           (when hidestart
             (outline-flag-region hidestart
                                  (save-excursion (outline--end-of-previous)
                                                  (point))
                                  t)
             (setq hidestart nil))
           (let* ((heading (buffer-substring-no-properties
                            (pos-bol) (pos-eol))))
             (while (and path (>= (cdar path) level))
               (pop path))
             (push (cons heading level) path)
             (when (setq hidelevel (gethash (mapcar #'car path) paths))
               (setq hidestart (save-excursion (outline-end-of-heading)
                                               (point))))))
         (when (and current-path (equal current-path (mapcar #'car path)))
           (setq current-point (point)))))
     (point-min) (point-max))
    (when hidestart
      (outline-flag-region hidestart
                           (save-excursion
                             (goto-char (point-max))
                             (outline--end-of-previous)
                             (point))
                           t))
    (when current-point (goto-char current-point))))