I have an org file with lots of babel source blocks in it that only need to be re-executed when the code is changed.
How do I prevent org from executing all of the blocks during export? In other words, set them all to manual execution only?
I would prefer a single global option rather than having to edit each block individually.
Setting the variable org-export-babel-evaluate to nil will avoid code evaluation, but it will also cause all source block header arguments to be ignored This means that code blocks with the argument :exports none
or :exports results
will end up in the export. This caught me off guard.
The alternative is to use the header argument :eval no-export
on a file basis and then remove that line when re-running the source code:
#+PROPERTY: HEADER-ARGS+ :eval no-export
See the docstring for org-babel-evaluate:
Switch controlling code evaluation and header processing during export. When set to nil no code will be evaluated as part of the export process and no header arguments will be obeyed. Users who wish to avoid evaluating code on export should use the header argument ‘:eval never-export’.