org-cycle: Allow intuitively used values of of `org-startup-folded'

* lisp/org-cycle.el (org-cycle-set-startup-visibility): Recognize
`org-startup-folded' set to symbols `fold', `nofold', and `showall'.
They are used as #+STARTUP: option and often tried blindly by users.
This commit is contained in:
Ihor Radchenko 2023-02-18 15:29:35 +03:00
parent fe92a3cedb
commit 747e60629f
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 7 additions and 3 deletions

View File

@ -608,7 +608,9 @@ With a numeric prefix, show all headlines up to that level."
(defun org-cycle-set-startup-visibility ()
"Set the visibility required by startup options and properties."
(cond
((eq org-startup-folded t)
;; `fold' is technically not allowed value, but it is often
;; intuitively tried by users by analogy with #+STARTUP: fold.
((memq org-startup-folded '(t fold))
(org-cycle-overview))
((eq org-startup-folded 'content)
(org-cycle-content))
@ -620,8 +622,10 @@ With a numeric prefix, show all headlines up to that level."
(org-cycle-content 4))
((eq org-startup-folded 'show5levels)
(org-cycle-content 5))
((or (eq org-startup-folded 'showeverything)
(eq org-startup-folded nil))
;; `nofold' and `showall' are technically not allowed values, but
;; they are often intuitively tried by users by analogy with
;; #+STARTUP: nofold or #STARUP: showall.
((memq org-startup-folded '(showeverything nil nofold showall))
(org-fold-show-all)))
(unless (eq org-startup-folded 'showeverything)
(when org-cycle-hide-block-startup (org-fold-hide-block-all))