I think I know how to control automatic evaluation of code blocks with the :exports keyword and with the #+call: tag, but my blocks only leave #+RESULTS: when I run them manually via C-c C-c. Is automatic code eval-on-export only for side effects? Here is a MVE:

Here's a source block that executes automatically (modulo security)
when we say ~M-x org-latex-export-to-pdf~

#+name: square
#+header: :var x=0
#+begin_src python :exports code
  return x*x

It seems to execute automatically because of the following
~#+call~ tag: if I remove the tag, the code doesn't execute
automatically any more:

#+call: square(7)

In any case, it only leaves a result in the emacs buffer under a
~#+RESULTS:~ tag if I run it manually via =C-c C-c=.  Why
doesn't it leave a result when it runs automatically?  Is automatic
running only for side effects?

Here is a code block that runs automatically only if I say
~:exports both~ or ~:exports results~.

#+name: ftw-python
#+begin_src python :exports both
  return 43

It also doesn't leave a result unless I run it manually.
  • Yeah, the lack of results section after eval seems confusing. I ran into this issue when i wanted the code block on export to be evaluated, but not exported. After fiddling around a bit, this is what I got: :results silent :exports results evals automatically, but doesn't export. Commented Feb 20, 2018 at 8:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.