1

I am using Doom Emacs. I like having indentation for most of my org files, but I have one folder where I want to have org files without indenting, to use for writing documents.

I have already tested adding #+STARTUP noindent, and that works per file, but I'm trying to find a way to make it the default for the folder.

I used add-dir-local-variable, to set org-indent-mode to nil, and I can see that was written to a .dir_locals.el in the folder I want to make the change for. But when I open an Org file it is still indented. If, after the file is open, I manually toggle org-indent-mode, I can turn the indenting on and off. Seems like maybe a matter of the sequence or I'm going about this the wrong way. If it helps, here is the .dir_locals.el

;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((org-mode
  (org-indent-mode nil)))
4

C-h v org-indent-mode RET says (emphasis added):

If called interactively, enable Org-Indent mode if ARG is positive, and disable it if ARG is zero or negative. If called from Lisp, also enable the mode if ARG is omitted or nil, and toggle it if ARG is ‘toggle’; disable the mode otherwise.

You probably want to say (edited as per the OP's answer to avoid misleading future visitors):

((org-mode . ((eval . (org-indent-mode -1)))))

in your .dir-locals.el file.

| improve this answer | |
2

Thank you NickD for your help, it got me to the right answer! Doing exactly what is listed above worked when added to the Doom Emacs config.el but not in the .dir-locals.el. To make it work as a directory variable, adding an eval seems to have done the trick. Here is my updated .dir-locals.el'

;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((org-mode . ((eval . (org-indent-mode -1)))))

| improve this answer | |
  • 1
    Right - this is a local variables file after all. I'll fix up my answer to avoid misleading future visitors. Thanks! – NickD Jul 13 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.