branch: externals/org
commit 747e60629f9504f5ebfa00b3b8b60fb9050c6d6e
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    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.
---
 lisp/org-cycle.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/org-cycle.el b/lisp/org-cycle.el
index fafcfd7977..50aa0d21d6 100644
--- a/lisp/org-cycle.el
+++ b/lisp/org-cycle.el
@@ -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))

Reply via email to