summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustav Wikström <gustav@whil.se>2020-12-10 10:16:01 +0100
committerGustav Wikström <p950gsw@fspa.myntet.se>2020-12-10 10:35:59 +0100
commita71ac14e46bb820abdbd2e6651c58179c50eb2fa (patch)
tree902279a2f9bc8d43bf360c7ed50e6736ec274052
parent752f01fdc6ef9e7553ac5b9c0982cddfd8ca81c1 (diff)
downloadorg-mode-a71ac14e46bb820abdbd2e6651c58179c50eb2fa.tar.gz
New startup options, #+startup: show<n>levels
* lisp/org.el (org-startup-folded, org-startup-options) (org-set-startup-visibility): Add new startup options
-rw-r--r--doc/org-guide.org4
-rw-r--r--doc/org-manual.org8
-rw-r--r--etc/ORG-NEWS6
-rw-r--r--lisp/org.el17
4 files changed, 33 insertions, 2 deletions
diff --git a/doc/org-guide.org b/doc/org-guide.org
index 150762b..1082b9b 100644
--- a/doc/org-guide.org
+++ b/doc/org-guide.org
@@ -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
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 5a84a6d..a664a01 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -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
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 0d08a93..196474f 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -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
diff --git a/lisp/org.el b/lisp/org.el
index 9039a8c..ac1bdf0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -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)))