Function: outline--cycle-state

outline--cycle-state is a byte-compiled function defined in outline.el.gz.

Signature

(outline--cycle-state)

Documentation

Return the cycle state of current heading.

Return either hide-all, headings-only, or show-all.

Source Code

;; Defined in /usr/src/emacs/lisp/outline.el.gz
;;; Visibility cycling

(defun outline--cycle-state ()
  "Return the cycle state of current heading.
Return either `hide-all', `headings-only', or `show-all'."
  (save-excursion
    (let (start end ov-list heading-end)
      (outline-back-to-heading)
      (setq start (point))
      (outline-end-of-heading)
      (setq heading-end (point))
      (outline-end-of-subtree)
      (setq end (point))
      (setq ov-list
            (seq-filter
             (lambda (o)
               (and (eq (overlay-get o 'invisible) 'outline)
                    (save-excursion
                      (goto-char (overlay-start o))
                      (outline-on-heading-p t))))
             (overlays-in start end)))
      (cond ((null ov-list) 'show-all)
            ((and (or (= end (point-max)
                         (1+ (overlay-end (car ov-list))))
                      (= (overlay-end (car ov-list)) end))
                  (= (overlay-start (car ov-list)) heading-end))
             'hide-all)
            (t 'headings-only)))))