Variable: org-indent-mode

org-indent-mode is a buffer-local variable defined in org-indent.el.gz.

Documentation

Non-nil if Org-Indent mode is enabled.

Use the command org-indent-mode(var)/org-indent-mode(fun) to change this variable.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-indent.el.gz
;;;###autoload
(define-minor-mode org-indent-mode
  "When active, indent text according to outline structure.

Internally this works by adding `line-prefix' and `wrap-prefix'
properties, after each buffer modification, on the modified zone.

The process is synchronous.  Though, initial indentation of
buffer, which can take a few seconds on large buffers, is done
during idle time."
  :lighter " Ind"
  (cond
   (org-indent-mode
    ;; mode was turned on.
    (setq-local indent-tabs-mode nil)
    (setq-local org-indent--initial-marker (copy-marker 1))
    (when org-indent-mode-turns-off-org-adapt-indentation
      ;; Don't turn off `org-adapt-indentation' when its value is
      ;; 'headline-data, just indent headline data specially.
      (or (eq org-adapt-indentation 'headline-data)
	  (setq-local org-adapt-indentation nil)))
    (when org-indent-mode-turns-on-hiding-stars
      (setq-local org-hide-leading-stars t))
    (org-indent--compute-prefixes)
    (add-function :filter-return (local 'filter-buffer-substring-function)
                  #'org-indent-remove-properties-from-string)
    (add-hook 'after-change-functions 'org-indent-refresh-maybe nil 'local)
    (add-hook 'before-change-functions
	      'org-indent-notify-modified-headline nil 'local)
    (and font-lock-mode (org-restart-font-lock))
    (org-indent-remove-properties (point-min) (point-max))
    ;; Submit current buffer to initialize agent.  If it's the first
    ;; buffer submitted, also start the agent.  Current buffer is
    ;; pushed in both cases to avoid a race condition.
    (if org-indent-agentized-buffers
	(push (current-buffer) org-indent-agentized-buffers)
      (push (current-buffer) org-indent-agentized-buffers)
      (setq org-indent-agent-timer
	    (run-with-idle-timer 0.2 t #'org-indent-initialize-agent))))
   (t
    ;; Mode was turned off (or we refused to turn it on)
    (kill-local-variable 'org-adapt-indentation)
    (setq org-indent-agentized-buffers
	  (delq (current-buffer) org-indent-agentized-buffers))
    (when (markerp org-indent--initial-marker)
      (set-marker org-indent--initial-marker nil))
    (when (local-variable-p 'org-hide-leading-stars)
      (kill-local-variable 'org-hide-leading-stars))
    (remove-function (local 'filter-buffer-substring-function)
                     #'org-indent-remove-properties-from-string)
    (remove-hook 'after-change-functions 'org-indent-refresh-maybe 'local)
    (remove-hook 'before-change-functions
		 'org-indent-notify-modified-headline 'local)
    (org-with-wide-buffer
     (org-indent-remove-properties (point-min) (point-max)))
    (and font-lock-mode (org-restart-font-lock))
    (redraw-display))))