2

I need this line in every my org files. It's tedious to include it in everyone of them.

3
  • You can use one of the many template systems to include it whenever the file is created. See e.g. autoinsert.el for a very simple system - I'm sure there are more complicated ones with more capabilities. Do C-v f auto-insert and go from there. Also check the Emacs Wiki.
    – NickD
    Jan 7, 2021 at 19:59
  • @NickD Thanks for your relay. But what I want is to get rid of this line in my org files, to make it exist in some dir local variable form. I have no idea what variable name should I use.
    – nichijou
    Jan 8, 2021 at 4:10
  • I don't think you can do that without changing Org mode code: AFAIK there is no such variable. You might want to submit an RFE to the Org mode mailing list.
    – NickD
    Jan 8, 2021 at 13:30

1 Answer 1

1

Currently I'm capitalizing on the org-export-before-parsing-hook, which runs before the buffer is parsed by the back-end.

dir-local.el

((org-mode . ((org-export-before-parsing-hook . ((lambda (bach-end) 
                                                   (goto-char 0)
                                                   (insert "#+SETUPFILE: ./assets/my-theme-readtheorg.setup\n")))))))

It won't actually alter your file.

For org-export-before-parsing-hook is risky, you may consider to add it to safe-local-variable-values to avoid Emacs's querying.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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