Function: org-num-mode

org-num-mode is an autoloaded, interactive and byte-compiled function defined in org-num.el.gz.

Signature

(org-num-mode &optional ARG)

Documentation

Dynamic numbering of headlines in an Org buffer.

This is a minor mode. If called interactively, toggle the Org-Num mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate the variable org-num-mode(var)/org-num-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-num.el.gz
;;;###autoload
(define-minor-mode org-num-mode
  "Dynamic numbering of headlines in an Org buffer."
  :lighter " o#"
  (cond
   (org-num-mode
    (unless (derived-mode-p 'org-mode)
      (user-error "Cannot activate headline numbering outside Org mode"))
    (org-num--clear)
    (setq org-num--numbering nil)
    (setq org-num--overlays (nreverse (org-num--number-region nil nil)))
    (add-hook 'after-change-functions #'org-num--verify nil t)
    (add-hook 'change-major-mode-hook #'org-num--clear nil t))
   (t
    (org-num--clear)
    (remove-hook 'after-change-functions #'org-num--verify t)
    (remove-hook 'change-major-mode-hook #'org-num--clear t))))