Search code examples
emacsorg-mode

How to enable org-indent-mode by default?


I am using Emacs 25.1.50.2

When I am using Org-mode, the org-indent-mode is off by default. So I have to enable it using M-x org-indent-mode everytime.

I put the lisp below into my config file ~/.emecs.d/init.el with no effect.

;; Enable org-indent mode by default
(org-indent mode 1)
;; Above line really should be (org-indent-mode 1)

Thanks for your time :)


Solution

  • You can use the mode hook for the major mode to enable this buffer-local minor mode in org-mode buffers.

    For Emacs 24+ you can simply write:

    (add-hook 'org-mode-hook 'org-indent-mode)
    

    In earlier Emacs versions you should instead use a custom function to explicitly enable the minor mode by calling (org-indent-mode 1), and then add that custom function to the hook variable.