[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Confused about source code blocks evaluation when exporting
From: |
Rudolf Adamkovič |
Subject: |
Re: Confused about source code blocks evaluation when exporting |
Date: |
Thu, 14 Jul 2022 08:06:58 +0200 |
Alain.Cochard@unistra.fr writes:
> Org evaluates source code blocks in an Org file during export.
I have just tried to export the following document:
#+begin_src emacs-lisp :exports both
(+ 1 1)
#+end_src
The exported HTML file contains the expression '(+ 1 1)' along with '2',
its value. It follows that Emacs does evaluate source blocks on export.
(Note that Org did not add RESULTS to the Org file during export, for no
export should ever modify the source file in any way.)
> why does '#+RESULTS:' show 'bar' and not 'foo'?
By default, the Org mode captures the value of the last expression. In
your case, the last expression has the value of 'bar'.
If you want to capture something else for the result, such as standard
output, you must tell Org Babel about it with the ':results' argument.
It makes sense, if you think about it. The computer cannot possibly
know what you want to capture.
Rudy
--
"The introduction of suitable abstractions is our only mental aid to
organize and master complexity."
-- Edsger Wybe Dijkstra, 1930-2002
Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia
- Re: Confused about source code blocks evaluation when exporting, (continued)
- Re: Confused about source code blocks evaluation when exporting, Fraga, Eric, 2022/07/13
- Re: Confused about source code blocks evaluation when exporting, Alain . Cochard, 2022/07/13
- Re: Confused about source code blocks evaluation when exporting, Fraga, Eric, 2022/07/14
- Re: Confused about source code blocks evaluation when exporting, Alain . Cochard, 2022/07/14
- Re: Confused about source code blocks evaluation when exporting, Fraga, Eric, 2022/07/14
- Re: Confused about source code blocks evaluation when exporting, Alain . Cochard, 2022/07/20
- Re: Confused about source code blocks evaluation when exporting, Fraga, Eric, 2022/07/20
- Re: Confused about source code blocks evaluation when exporting, Alain . Cochard, 2022/07/22
- Re: Confused about source code blocks evaluation when exporting, Fraga, Eric, 2022/07/22
- Re: Confused about source code blocks evaluation when exporting, Alain . Cochard, 2022/07/22
Re: Confused about source code blocks evaluation when exporting,
Rudolf Adamkovič <=