org.el: New option `org-startup-numeroted' and #+startup: num

* lisp/org.el (org-startup-numeroted): New option.
(org-startup-options): New "num" and "nonum" startup keywords.
(org-mode): Startup according `org-startup-numeroted' or the
local #+startup setup.

* doc/org-manual.org (Dynamic Headline Numbering)
(Summary of In-Buffer Settings): Document
`org-startup-numeroted' and #startup: num.

* etc/ORG-NEWS: Document the new startup option.

Thanks to Guillaume MULLER for this idea.
This commit is contained in:
Bastien 2020-02-18 13:27:33 +01:00
parent 44e17c420b
commit 325962c003
3 changed files with 42 additions and 0 deletions

View File

@ -18694,6 +18694,11 @@ If ~org-num-skip-footnotes~ is non-~nil~, footnotes sections (see
You can control how the numbering is displayed by setting
~org-num-face~ and ~org-num-format-function~.
#+vindex: org-startup-numeroted
You can also turn this mode globally for all Org files by setting the
option ~org-startup-numeroted~ to =t=, or locally on a file by using
=#+startup: num=.
** The Very Busy {{{kbd(C-c C-c)}}} Key
:PROPERTIES:
:DESCRIPTION: When in doubt, press @kbd{C-c C-c}.
@ -18865,6 +18870,13 @@ changes.
| =indent= | Start with Org Indent mode turned on. |
| =noindent= | Start with Org Indent mode turned off. |
#+vindex: org-startup-numeroted
Dynamic virtual numerotation of headlines is controlled by the variable
~org-startup-numeroted~.
| =num= | Start with Org num mode turned on. |
| =nonum= | Start with Org num mode turned off. |
#+vindex: org-startup-align-all-tables
Aligns tables consistently upon visiting a file. The
corresponding variable is ~org-startup-align-all-tables~ with

View File

@ -116,6 +116,12 @@ minutes.
You can now use =C-x C-+= in column view: the columns face size will
increase or decrease, together with the column header size.
*** New startup option =#+startup: num=
When this startup option is set, display headings as numeroted.
Use =#+startup: nonum= to turn this off.
*** =ob-clojure.el= supports inf-clojure.el and ClojureScript evaluation
You can now set ~(setq org-babel-clojure-backend 'inf-clojure)~ and
@ -203,6 +209,14 @@ This option will add a timeout to notifications.
Functions in this hook are run after ~org-agenda-filter~ is called.
*** New option ~org-startup-numeroted~
When this option is =t=, Org files will start using ~(org-num-mode 1)~
and headings will be visually numeroted.
You can turn this on/off on a per-file basis with =#+startup: num= or
=#+startup: nonum=.
** Removed or renamed functions and variables
*** Renamed ~org-columns-set-tags-or-toggle~

View File

@ -972,6 +972,19 @@ the following lines anywhere in the buffer:
(const :tag "Not" nil)
(const :tag "Globally (slow on startup in large files)" t)))
(defcustom org-startup-numeroted nil
"Non-nil means turn on `org-num-mode' on startup.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
#+STARTUP: num
#+STARTUP: nonum"
:group 'org-structure
:package-version '(Org . "9.4")
:type '(choice
(const :tag "Not" nil)
(const :tag "Globally" t)))
(defcustom org-use-sub-superscripts t
"Non-nil means interpret \"_\" and \"^\" for display.
@ -4050,6 +4063,8 @@ After a match, the following groups carry important information:
("content" org-startup-folded content)
("indent" org-startup-indented t)
("noindent" org-startup-indented nil)
("num" org-startup-numeroted t)
("nonum" org-startup-numeroted nil)
("hidestars" org-hide-leading-stars t)
("showstars" org-hide-leading-stars nil)
("odd" org-odd-levels-only t)
@ -4809,6 +4824,7 @@ The following commands are available:
(when org-startup-with-latex-preview (org-latex-preview '(16)))
(unless org-inhibit-startup-visibility-stuff (org-set-startup-visibility))
(when org-startup-truncated (setq truncate-lines t))
(when org-startup-numeroted (require 'org-num) (org-num-mode 1))
(when org-startup-indented (require 'org-indent) (org-indent-mode 1))))
;; Activate `org-table-header-line-mode'