From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Hannon Subject: Question about using :cache in Babel (for R) Date: Tue, 27 Sep 2011 13:53:20 -0700 (PDT) Message-ID: <1317156800.22065.YahooMailNeo@web161912.mail.bf1.yahoo.com> Reply-To: Michael Hannon Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="1923625488-1059729601-1317156800=:22065" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:50283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8eeZ-00024W-06 for emacs-orgmode@gnu.org; Tue, 27 Sep 2011 16:53:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8eeX-0004la-MV for emacs-orgmode@gnu.org; Tue, 27 Sep 2011 16:53:22 -0400 Received: from nm19.bullet.mail.bf1.yahoo.com ([98.139.212.178]:29664) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1R8eeX-0004l1-GL for emacs-orgmode@gnu.org; Tue, 27 Sep 2011 16:53:21 -0400 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: Org-Mode List --1923625488-1059729601-1317156800=:22065 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Greetings. =A0I have a question that relates to the use of the :cache optio= n in=0ABabel sessions using R.=0A=0AHere's the relevant configuration infor= mation:=0A=0A=A0 =A0 Emacs =A0: GNU Emacs 23.2.1 (x86_64-redhat-linux-gnu, = GTK+ Version 2.24.4)=0A=A0 =A0 =A0of 2011-05-23 on x86-12.phx2.fedoraprojec= t.org=0A=A0 =A0 Package: Org-mode version 7.7 (release_7.7.328.g1a97)=0A=0A= I've appended the text of a file that exhibits the issue, which is the=0Afo= llowing. =A0If I explicitly evaluate a given code block, using, let's say, = C-c=0AC-c, I get the results stuck into the Org file, as in the first sourc= e-code=0Ablock below. =A0If I then repeatedly export the file (to PDF, HTML= , etc.), I get=0Athe cached results in the exported document. =A0For instan= ce, the mean of the=0Arandom variable does not change as I repeatedly expor= t the file.=0A=0AIf for some reason I have NOT explicitly evaluated a given= code block, as with=0Athe second code block below, then during export I se= e a message "Evaluating=0Acode block" (or similar), indicating that Babel i= s NOT using a cached version,=0Aand no cacheable output is produced as a re= sult, meaning that the entire=0Acalculation will be repeated during the nex= t export. =A0For instance, the mean=0Aof the random variable will be differ= ent every time I export the file.=0A=0AI guess I can see the logic of this,= but I wonder if there is some way to=0Ainstruct Babel to automatically cac= he the output of any code blocks it=0Aevaluates, i.e., via a header argumen= t or elisp variable or ... .=0A=0AThanks,=0A=0A-- Mike=0A=0AP.S. Is the SHA= 1(?) identifier for the results a new feature?=0A=0A----------=0A=0A#+TITLE= :=A0=0A#+AUTHOR:=0A#+DATE:=0A=0A#+STARTUP: hideblocks=0A#+BABEL: :session *= R* :cache yes :results output verbatim :exports both=0A:tangle yes=0A=0A* T= his is a test=0A=0A#+begin_src R=0A=0A=A0 x =3D rnorm(10)=0A=A0 mean(x)=0A= =0A#+end_src=0A=0A#+results[9b9372488662083d0d211b9aad9c2985faba20cd]:=0A: = [1] -0.07904561=0A=0A* Here's a second test=0A=0A#+begin_src R=0A=0A=A0 x = =3D rnorm (50)=0A=A0 summary(x)=0A=0A#+end_src=0A --1923625488-1059729601-1317156800=:22065 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Greetings.  I have a qu= estion that relates to the use of the :cache option in
Babel s= essions using R.

Here's the relevant configu= ration information:

    Emacs &nb= sp;: GNU Emacs 23.2.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.4)=
     of 2011-05-23 on x86-12.phx2.fedoraproject.org
  &= nbsp; Package: Org-mode version 7.7 (release_7.7.328.g1a97)
I've appended the text of a file that exhibits the issue, w= hich is the
following.  If I explicitly evaluate a given = code block, using, let's say, C-c
C-c, I get the results stuck= into the Org file, as in the first source-code
block below. &= nbsp;If I then repeatedly export the file (to PDF, HTML, etc.), I get
the cache= d results in the exported document.  For instance, the mean of the
random variable does not change as I repeatedly export the file.<= /font>

If for some reason I have NOT explicitly eva= luated a given code block, as with
the second code block below= , then during export I see a message "Evaluating
code block" (= or similar), indicating that Babel is NOT using a cached version,
and no cacheable output is produced as a result, meaning that the entire
<= font class=3D"Apple-style-span" face=3D"'lucida console', sans-serif">calcu= lation will be repeated during the next export.  For instance, the mea= n

I guess I can see the logic of th= is, but I wonder if there is some way to
instruct Babel to aut= omatically cache the output of any code blocks it
evaluates, i= .e., via a header argument or elisp variable or ... .

Thanks,

-- Mike

P.S. Is the SHA1(?) identifier for the results a new feature?

----------

#+TITLE: 
#+AUTHOR:
#+DATE:

#+STARTUP: hideblocks
#+BABEL: :se= ssion *R* :cache yes :results output verbatim :exports both
:t= angle yes

* This is a test
=
=
#+begin_s= rc R

  x =3D rnorm(10)
&nb= sp; mean(x)

#+end_src

#+results[9b9372488662083d0d211b9aad9c2985faba20cd]:
<= div>= : [1] -0.07904561

* Here's a second test

#+begin_src R

  x =3D rnorm (= 50)
  summary(x)

#+end_src=

--1923625488-1059729601-1317156800=:22065--