emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Get =#+RESULTS= without re-evaluating source code block?


From: doltes
Subject: Re: Get =#+RESULTS= without re-evaluating source code block?
Date: Wed, 27 Jan 2021 18:33:13 -0500
User-agent: mu4e 1.4.14; emacs 27.1

Yes, it worked like a charm!

Thanks!

tomas@tuxteam.de writes:

> On Wed, Jan 27, 2021 at 05:14:43PM -0500, doltes wrote:
>> Get =#+RESULTS= without re-evaluating source code block?
>> 
>> Let's suppose I have a code block which requires a long time to finish
>> 
>> #+NAME: big-computation
>> #+begin_src bash
>> sleep 5 # Some computation which requires a long time to complete.
>> echo a
>> #+end_src
>> 
>> #+RESULTS: big-computation
>> #+begin_example
>> a
>> #+end_example
>> 
>> I want to use the results of that code block in other code blocks so I
>> use a =noweb= reference (see below.)
>> 
>> #+begin_src bash :noweb yes
>> printf "%s\n" <<big-computation()>>
>> #+end_src
>> 
>> #+RESULTS:
>> #+begin_example
>> a
>> 
>> #+end_example
>> 
>> However, doing this (i.e. using a =noweb= reference) would make the
>> command to be evaluated whenever getting its results. I don't want
>> this, I want the =:noweb= reference to actually use the already
>> computed results.
>> 
>> So, my question is: Is it possible to use the actual =#+RESULTS= code
>> block instead of always evaluating it when referencing the results
>> through a =:noweb= reference?
>
> Perhaps "Cache results of evaluation" (15.5 Evaluating Code Blocks,
> in the Interwebs here [1] is for you.
>
> In short, add a header argument :cache yes to your code block.
>
> Cheers
>
> [1] https://orgmode.org/org.html#Evaluating-Code-Blocks
>
>  - t


-- 
Greetings,
doltes.



reply via email to

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