Function: org-cycle-set-visibility-according-to-property

org-cycle-set-visibility-according-to-property is an interactive and byte-compiled function defined in org-cycle.el.gz.

Signature

(org-cycle-set-visibility-according-to-property)

Documentation

Switch subtree visibility according to VISIBILITY property.

Key Bindings

Aliases

org-set-visibility-according-to-property (obsolete since 9.6)

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-cycle.el.gz
(defun org-cycle-set-visibility-according-to-property ()
  "Switch subtree visibility according to VISIBILITY property."
  (interactive)
  (let ((regexp (org-re-property "VISIBILITY")))
    (org-with-point-at 1
      (while (re-search-forward regexp nil t)
	(let ((state (match-string 3)))
	  (if (not (org-at-property-p)) (outline-next-heading)
	    (save-excursion
	      (org-back-to-heading t)
	      (org-fold-subtree t)
	      (pcase state
		("folded"
		 (org-fold-subtree t))
		("children"
		 (org-fold-show-hidden-entry)
		 (org-fold-show-children))
		("content"
                 ;; Newline before heading will be outside the
                 ;; narrowing.  Make sure that it is revealed.
                 (org-fold-heading nil)
		 (save-excursion
		   (save-restriction
		     (org-narrow-to-subtree)
		     (org-cycle-content))))
		((or "all" "showall")
		 (org-fold-show-subtree))
		(_ nil)))
	    (org-end-of-subtree)))))))