Function: org-cycle-hide-drawers

org-cycle-hide-drawers is a byte-compiled function defined in org-cycle.el.gz.

Signature

(org-cycle-hide-drawers STATE)

Documentation

Re-hide all drawers after a visibility state change.

STATE should be one of the symbols listed in the docstring of org-cycle-hook.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-cycle.el.gz
;;;; Implementation:

(defun org-cycle-hide-drawers (state)
  "Re-hide all drawers after a visibility state change.
STATE should be one of the symbols listed in the docstring of
`org-cycle-hook'."
  (when (derived-mode-p 'org-mode)
    (cond ((not (memq state '(overview folded contents)))
           (let* ((global? (eq state 'all))
                  (beg (if global? (point-min) (line-beginning-position)))
                  (end (cond (global? (point-max))
                             ((eq state 'children) (org-entry-end-position))
                             (t (save-excursion (org-end-of-subtree t t))))))
             (org-fold--hide-drawers beg end)))
          ((memq state '(overview contents))
           ;; Hide drawers before first heading.
           (let ((beg (point-min))
                 (end (save-excursion
                        (goto-char (point-min))
                        (if (org-before-first-heading-p)
                            (org-entry-end-position)
                          (point-min)))))
             (when (< beg end)
               (org-fold--hide-drawers beg end)))))))