emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Bug: cached code blocks should return the same value [8.3.1]


From: Aaron Ecay
Subject: Re: [O] Bug: cached code blocks should return the same value [8.3.1]
Date: Fri, 30 Oct 2015 09:53:09 +0000
User-agent: Notmuch/0.20.2+65~gbd5504e (http://notmuchmail.org) Emacs/25.0.50.2 (x86_64-unknown-linux-gnu)

Hi Benda,

2015ko irailak 18an, Benda Xu-ek idatzi zuen:

[...]

> However, this feature does not work with cache.  In case that "input"
> code block takes a long time to evaluate, it is a good idea to cache the
> result.  But that returns "nil" in subsequent function calls:
> 
>    #+name: input
>    #+BEGIN_SRC sh :results output :cache yes
>    echo "3"
>    #+END_SRC
> 
>    #+RESULTS[f69ecd305ebd448fc39b05809d214261a777c6bc]: input
>    : 3
> 
>    #+BEGIN_SRC R :var a=input()
>    a
>    #+END_SRC
> 
>    #+RESULTS:
>    : nil
> 
> Recalling the cached function should return exactly the same result by
> definition of "cache".

I can’t reproduce this on org master.

> 
> Or is there a way to circumvent this by referring to the "RESULT" field
> directly?

I believe you can add a name to the results, and use that:

,----
| #+name: input
| #+BEGIN_SRC sh :results output :cache yes
| echo "3"
| #+END_SRC
| 
| #+name: input-results
| #+RESULTS[f69ecd305ebd448fc39b05809d214261a777c6bc]: input
| : 3
| 
| #+BEGIN_SRC R :var a=input-results
| a
| #+END_SRC
| 
| #+RESULTS:
| : 3
`----


Hope this helps,

-- 
Aaron Ecay



reply via email to

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