I want to use the noweb style references in Emacs org for literate programming.

Consider the following working code.

#+NAME:Header
#+BEGIN_SRC c++
#include <iostream>
#+END_SRC


Blah blah


#+BEGIN_SRC c++ :tangle test.cpp :noweb yes
<<Header>>
int main (void)
{
   std::cout << "Hello World" << std::endl;
}
#+END_SRC

I don't want to have to specify :noweb yes every time to expand noweb references since I will always be expanding them by default. How do I change my .emacs file to tell org mode this?

up vote 2 down vote accepted

There's an example for doing just what you are asking in the Org Manual:

https://orgmode.org/manual/System_002dwide-header-arguments.html#System_002dwide-header-arguments

Here it is for convenience:

This example sets :noweb header arguments to yes, which makes Org expand :noweb references by default.

 (setq org-babel-default-header-args
      (cons '(:noweb . "yes")
            (assq-delete-all :noweb org-babel-default-header-args)))

Try setq org-babel-default-header-args.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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