[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: Fraga, Eric
Subject: Re: Confused about source code blocks evaluation when exporting
Date: Wed, 13 Jul 2022 10:57:39 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

On Tuesday, 12 Jul 2022 at 23:13, Alain.Cochard@unistra.fr wrote:
> I guess I didn't use 'incidental' correctly.  I meant it as "not my
> main concern".  Anyway, thank you; I could check that if I switch the
> 2 lines I indeed get '#+RESULTS:' to show foo'.

No, you used the word correctly.  My point was that this was your main
issue!  Understanding what is the "result" of a src block evaluation is

> Thank you both, I made progress; but the behavior is still very so
> unintuitive to me.  For example, I haven't found a way to have this
> block:
> #+begin_src emacs-lisp <arguments to be determined>
>   (message "foo")
>   (message "bar")

If you want output, maybe use "print" instead of "message".  However,
you will get quotes around the strings.  The best alternative would be
to have a single elisp statement that returns what you want output:

#+begin_src emacs-lisp :results value
  (concat "Foo"

> Finally I still tend to consider that the sentence "Org evaluates
> source code blocks in an Org file during export" is confusing.  But
> maybe that's just I who interpret this as "code evaluation is the
> default behavior upon export".

I do not quite understand the difference.  Evaluation happens (subject
to confirmation).  What may happen with that evaluation, however, might
not be what you want by default.  What is it you want on export?  If you
want the code and the results, add ":exports both" to the begin_src
line.  Straightforward?

: Eric S Fraga, with org release_9.5.4-623-gc66bdb in Emacs 29.0.50

reply via email to

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