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)

1 Answer 1

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

2
  • 1
    :tangle yes needed in the PROPERTY args to works
    – gigiair
    Mar 29, 2018 at 7:15
  • 2
    works after I did a C-c C-c to refresh the local setup
    – user10000
    Nov 25, 2018 at 19:05

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.