From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: Bug: cached code blocks should return the same value [8.3.1] Date: Fri, 30 Oct 2015 09:53:09 +0000 Message-ID: <87wpu4wum2.fsf@gmail.com> References: <87a8sk3uce.fsf@gentoo.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zs6N6-0004Xa-7E for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 05:53:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zs6N2-00063N-VI for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 05:53:20 -0400 Received: from mail-wi0-x230.google.com ([2a00:1450:400c:c05::230]:36974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zs6N2-00063I-Oz for emacs-orgmode@gnu.org; Fri, 30 Oct 2015 05:53:16 -0400 Received: by wicfv8 with SMTP id fv8so6977494wic.0 for ; Fri, 30 Oct 2015 02:53:16 -0700 (PDT) In-Reply-To: <87a8sk3uce.fsf@gentoo.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Benda Xu , emacs-orgmode@gnu.org 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: >=20 > #+name: input > #+BEGIN_SRC sh :results output :cache yes > echo "3" > #+END_SRC >=20 > #+RESULTS[f69ecd305ebd448fc39b05809d214261a777c6bc]: input > : 3 >=20 > #+BEGIN_SRC R :var a=3Dinput() > a > #+END_SRC >=20 > #+RESULTS: > : nil >=20 > Recalling the cached function should return exactly the same result by > definition of "cache". I can=E2=80=99t reproduce this on org master. >=20 > 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 |=20 | #+name: input-results | #+RESULTS[f69ecd305ebd448fc39b05809d214261a777c6bc]: input | : 3 |=20 | #+BEGIN_SRC R :var a=3Dinput-results | a | #+END_SRC |=20 | #+RESULTS: | : 3 `---- Hope this helps, --=20 Aaron Ecay