[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Confused about source code blocks evaluation when exporting

From: Alain . Cochard
Subject: Re: Confused about source code blocks evaluation when exporting
Date: Thu, 14 Jul 2022 10:09:25 +0200

Fraga, Eric writes on Thu 14 Jul 2022 07:06:
 > On Wednesday, 13 Jul 2022 at 23:06, Alain.Cochard@unistra.fr wrote:
 > > Now I start again, but I do 'C-c C-e l o' instead.  I am _not_ asked
 > > whether I want to evaluate, and the 'foo' file is still there.  But
 > > the pdf file does display
 > >
 > > rm -f foo
 > >
 > > Does this still qualify as "evaluation"?  I thought not, hence my
 > > conclusion that evaluation was not performed by default upon export,
 > > but you made me doubt it...
 > If you do not specify either ":exports results" or ":exports both",
 > then the exporter doesn't output the results and hence there is no
 > need to evaluate the src block.

Why "there is no need"?  It was not a theoretical issue for me.
Without latexmk installed, I had to setq a different value for
org-latex-pdf-process depending on whether I used

#+cite_export: natbib plainnat


#+cite_export: biblatex

Sure, I can do this is in the emacs init file but then I don't how any
better than to restart emacs.  So I tried to do it on the fly with an
src block of the form

#+begin_src emacs-lisp 
(setq org-latex-pdf-process <for natib or for biblatex>)

which I want to be evaluated during export but I want neither the code
not its results to appear on the exported pdf file.

Maybe there are smarter ways to achieve this goal, but it was an
opportunity for me anyway to start understanding this evaluation

There are other instances where this could be useful: evaluate some
shell block for deleting a file on the system before evaluating some
fortran code depending on this code.

 > The manual is indeed a bit vague about this so suggestions for
 > improvements are always welcome.

How about changing

   Org evaluates source code blocks in an Org file during export.


   Org generally evaluates source code blocks in an Org file during

But ideally it would be expanded, perhaps with something like
"depending on the value of some header arguments (see xxx)".

Also, how about a 'yes' option to the eval header argument to call for
unconditional evaluation?  Sorry if this would not make sense, I'm

Thank you all and best wishes.

EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 106]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | [ slot available for rent ]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]