9

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)

smilingbuddha
  • 1,131
  • 10
  • 26

1 Answers1

21

#+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: 16.8 Extracting Source Code

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

mankoff
  • 4,108
  • 1
  • 22
  • 39