3

I am planning to keep my .emacs file settings inside an org file which I can then tangle to a .emacs file. However, for every emacs-lisp block I don't want to have to type the redundant :tangle .emacs everytime.

e.g.

Description of flim-flam

#+BEGIN_SRC elisp :tangle .emacs
<flim-flam>
#+END_SRC

Description of foo-bar

#+BEGIN_SRC elisp :tangle .emacs
<foo-bar>
#+END_SRC

What must I include at the top of the Org document so that all code blocks (unless explicitly marked :tangle no) are automatically tangled into the same file say .emacs?

(This question applies to Org mode ≥9.0. For older versions, see Specify global tangle file for source code export in Org mode 8.x)

9

#+PROPERTY: header-args :tangle .emacs

You may need to C-c C-c on that line to invoke it after typing it, but in the future it should execute when the file is opened.

If you have multiple languages, you would set :tangle yes and then each code block would be tangled to the current file basename plus the appropriate language extension. I don't know how to tangle to a file named yes.


Manual section: https://orgmode.org/manual/tangle.html

How to have multiple #+PROPERTY: lines:How to specify default header arguments in orgmode code blocks

  • :tangle yes needed in the PROPERTY args to works – gigiair Mar 29 '18 at 7:15
  • works after I did a C-c C-c to refresh the local setup – Rudolf Olah Nov 25 '18 at 19:05

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.