New startup options, #+startup: show<n>levels

* lisp/org.el (org-startup-folded, org-startup-options)
  (org-set-startup-visibility): Add new startup options
This commit is contained in:
Gustav Wikström 2020-12-10 10:16:01 +01:00 committed by Gustav Wikström
parent 752f01fdc6
commit a71ac14e46
4 changed files with 33 additions and 2 deletions

View File

@ -169,8 +169,8 @@ Org uses just two commands, bound to {{{kbd(TAB)}}} and
When Emacs first visits an Org file, the global state is set to
OVERVIEW, i.e., only the top level headlines are visible. This can be
configured through the variable ~org-startup-folded~, or on a per-file
basis by adding a =STARTUP= keyword to =overview=, =content=, or
=showall=, like this:
basis by adding a =STARTUP= keyword to =overview=, =content=,
=showall=, =showeverything= or =show<n>levels= (n = 2..5) like this:
: #+STARTUP: content

View File

@ -578,6 +578,10 @@ buffer:
,#+STARTUP: overview
,#+STARTUP: content
,#+STARTUP: showall
,#+STARTUP: show2levels
,#+STARTUP: show3levels
,#+STARTUP: show4levels
,#+STARTUP: show5levels
,#+STARTUP: showeverything
#+end_example
@ -18960,6 +18964,10 @@ changes.
| =overview= | Top-level headlines only. |
| =content= | All headlines. |
| =showall= | No folding on any entry. |
| =show2levels= | Headline levels 1-2. |
| =show3levels= | Headline levels 1-3. |
| =show4levels= | Headline levels 1-4. |
| =show5levels= | Headline levels 1-5. |
| =showeverything= | Show even drawer contents. |
#+vindex: org-startup-indented

View File

@ -112,6 +112,12 @@ package, to convert pandas Dataframes into orgmode tables:
| 2 | 3 | 6 |
#+end_src
*** New startup options =#+startup: show<n>levels=
These startup options complement the existing =overview=, =content=,
=showall=, =showeverything= with a way to start the document with n
levels shown, where n goes from 2 to 5.
*** New =u= table formula flag to enable Calc units simplification mode
A new =u= mode flag for Calc formulas in Org tables has been added to

View File

@ -939,6 +939,7 @@ the following lines anywhere in the buffer:
#+STARTUP: fold (or `overview', this is equivalent)
#+STARTUP: nofold (or `showall', this is equivalent)
#+STARTUP: content
#+STARTUP: show<n>levels (<n> = 2..5)
#+STARTUP: showeverything
Set `org-agenda-inhibit-startup' to a non-nil value if you want
@ -949,6 +950,10 @@ time."
:type '(choice
(const :tag "nofold: show all" nil)
(const :tag "fold: overview" t)
(const :tag "fold: show two levels" show2levels)
(const :tag "fold: show three levels" show3levels)
(const :tag "fold: show four levels" show4evels)
(const :tag "fold: show five levels" show5levels)
(const :tag "content: all headlines" content)
(const :tag "show everything, even drawers" showeverything)))
@ -4121,6 +4126,10 @@ After a match, the following groups carry important information:
("overview" org-startup-folded t)
("nofold" org-startup-folded nil)
("showall" org-startup-folded nil)
("show2levels" org-startup-folded show2levels)
("show3levels" org-startup-folded show3levels)
("show4levels" org-startup-folded show4levels)
("show5levels" org-startup-folded show5levels)
("showeverything" org-startup-folded showeverything)
("content" org-startup-folded content)
("indent" org-startup-indented t)
@ -6553,6 +6562,14 @@ With a numeric prefix, show all headlines up to that level."
(org-overview))
((eq org-startup-folded 'content)
(org-content))
((eq org-startup-folded 'show2levels)
(org-content 2))
((eq org-startup-folded 'show3levels)
(org-content 3))
((eq org-startup-folded 'show4levels)
(org-content 4))
((eq org-startup-folded 'show5levels)
(org-content 5))
((or (eq org-startup-folded 'showeverything)
(eq org-startup-folded nil))
(org-show-all)))