From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Dynerman Subject: Re: Only evaluate code blocks interactively, but export results Date: Sat, 4 Apr 2015 13:55:17 -0500 Message-ID: References: <0119590B-CC3F-4CAF-85E6-E736C6755AB2@block-party.net> Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Content-Type: multipart/signed; boundary="Apple-Mail=_A30FD057-777E-426D-8CA2-9C5E11335E61"; protocol="application/pgp-signature"; micalg=pgp-sha512 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeTEZ-0004qh-Qu for emacs-orgmode@gnu.org; Sat, 04 Apr 2015 14:55:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeTEU-0001IA-QC for emacs-orgmode@gnu.org; Sat, 04 Apr 2015 14:55:55 -0400 Received: from block-party.net ([94.254.0.205]:46261 helo=anti-capital.block-party.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeTEU-0001GW-FZ for emacs-orgmode@gnu.org; Sat, 04 Apr 2015 14:55:50 -0400 In-Reply-To: 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: "Thomas S. Dye" Cc: emacs-orgmode@gnu.org --Apple-Mail=_A30FD057-777E-426D-8CA2-9C5E11335E61 Content-Type: multipart/alternative; boundary="Apple-Mail=_413F96B2-B882-474C-9533-F4B7996B0163" --Apple-Mail=_413F96B2-B882-474C-9533-F4B7996B0163 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Tom, Does :cache yes work with #+CALL lines? I=E2=80=99m not able to get it = to work. I=E2=80=99m calling my function through #+CALL=E2=80=99s because I=E2=80=99= d like to generate several figures from the same org-babel code block/ I tried adding :cache yes to: 1) The actual org-code block 2) The +CALL line, at the end 3) The +CALL line, before the argument list (i.e., = my_python_function[:cache yes](=E2=80=A6)) None of these worked - the code was still re-evaluated when I exported = the file, although the +RESULTS line got a hash value. Thank you very much, David > On Apr 4, 2015, at 12:15, Thomas S. Dye wrote: >=20 > Aloha David, >=20 > David Dynerman > = writes: >=20 >> Hi all, >>=20 >> I=E2=80=99m trying to accomplish the following: >>=20 >> 1) I have an org-babel python block in my code that produces a figure = file >> 2) I=E2=80=99d like to include the resulting figure HTML export of my = org file >> 3) The code takes a bit to run, so I don=E2=80=99t want to execute = the code >> block during each HTML export >>=20 >> What I have so far: >>=20 >> #+NAME: my_python_function >> #+HEADER: :var some python vars >> #+BEGIN_SRC python :results value file >> my python code >> #+END_SRC >> #+CALL: my_python_function(some python vars=3Dvalues) :results value = file :exports results >> #+CAPTION: Here is a figure >> #+LABEL: fig:an_amazing_figure >> #+ATTR_HTML: :height 200em >> #+RESULTS: >> [[file:output_file]] >>=20 >> This block works when I export to HTML (e.g. the code runs, and the >> figure is placed in the appropriate figure with the appropriate >> caption). >>=20 >> Question: How can I modify this so that the code is only executed = when >> I run C-c C-c on the +CALL line, but still have the figure in the >> exported HTML? >>=20 >> I tried adding :eval no-export to the code and to the +CALL line, but >> then the resulting HTML doesn=E2=80=99t contain the figure (it = outputs =E2=80=9Cnil=E2=80=9D, >> presumably because the CALL line is trying to call it, but the code = is >> refusing to run because of the no-export line) >=20 > You can set :cache yes, which can be used to avoid re-evaluating > unchanged code blocks. >=20 > hth, > Tom >=20 > -- > Thomas S. Dye > http://www.tsdye.com --Apple-Mail=_413F96B2-B882-474C-9533-F4B7996B0163 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi Tom,

Does :cache yes work with #+CALL lines? I=E2=80=99m not able = to get it to work.

I=E2=80=99m calling my function through #+CALL=E2=80=99s = because I=E2=80=99d like to generate several figures from the same = org-babel code block/

I tried adding :cache yes to: 

1) The actual org-code block
2) The +CALL line, at the end
3) The = +CALL line, before the argument list (i.e., my_python_function[:cache = yes](=E2=80=A6))

None of these worked - the code was still re-evaluated when I = exported the file, although the +RESULTS line got a hash = value.

Thank = you very much,
David


On Apr 4, 2015, at 12:15, = Thomas S. Dye <tsd@tsdye.com> wrote:

Aloha David,

David Dynerman <david@block-party.net> writes:

Hi all,
I=E2=80=99m trying to accomplish the following:

1) I have an org-babel python block in my code = that produces a figure file
2) I=E2=80=99d like to include = the resulting figure HTML export of my org file
3) The = code takes a bit to run, so I don=E2=80=99t want to execute the code
block during each HTML export

What= I have so far:

#+NAME: = my_python_function
#+HEADER: :var some python vars
#+BEGIN_SRC python :results value file
 my = python code
#+END_SRC
#+CALL: = my_python_function(some python vars=3Dvalues) :results value file = :exports results
#+CAPTION: Here is a figure
#+LABEL: fig:an_amazing_figure
#+ATTR_HTML: = :height 200em
#+RESULTS:
[[file:output_file]]

This block = works when I export to HTML (e.g. the code runs, and the
figure is placed in the appropriate figure with the = appropriate
caption).

Question:= How can I modify this so that the code is only executed when
I run C-c C-c on the +CALL line, but still have the figure in = the
exported HTML?

I tried = adding :eval no-export to the code and to the +CALL line, but
then the resulting HTML doesn=E2=80=99t contain the figure = (it outputs =E2=80=9Cnil=E2=80=9D,
presumably because the = CALL line is trying to call it, but the code is
refusing = to run because of the no-export line)

You can set :cache yes, which can be used to = avoid re-evaluating
unchanged code = blocks.

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

= --Apple-Mail=_413F96B2-B882-474C-9533-F4B7996B0163-- --Apple-Mail=_A30FD057-777E-426D-8CA2-9C5E11335E61 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVIDOtAAoJEBztEfokJf+KSaEQANCkPs8CQvoZajyz8jqfgyT9 R55J4lhhyaEUAKxrrNlEkqLdmbWzSQqIvfN7kHsQ0pfft627BBCd1eOsg6L37t1M 8PaSaA4idWu4cJfMZSrBFl4AaY+wkot6OvOzslXI3hCMJxejC8T80uR+z2vsiGSK 5ddg99f7lTK/wAUT8fDunWU3jip7pSj1GUuV9fAuRQoaPndEhcBpudDrKB4PQpKU a7Dfl01S/sb3xMIJkI7ghZRjsNAJdnzcLkXu4J9I12whd+2vXYMD/6hyzrODsOiM K8TaXStFSEAwFrIzGMlWF2NAJLDAWpzbC66NY3namSK7DzvfKnG94oCPAdkp6uX+ H/JgGPdPT9fSyFB26HKMo5PhG309UuBETjtcBSFA+95nWpbnsTni/SXy0kPY5emV ptK+6Q/hziUClO1QKahd9vaQa1pRgne90hnT6e60MRCrzFnagO1lYSHZV7XwnzLR 8DOj9IbMxLT31VaApbmj6TavjjlMhg2TbL8ZSOOVoCSY5fW2tzSQTuln5ZXDVpLu Xaf9ad5pw+kcGbUIeXVbmbiMGUq5WbiVihpd2b/32ijD7nJ8FuSBMH90HtKs8hBd g94+/6qinf1ZSfU3rguWDrW8cwUics8Me5CElfqikmC97WPUHECaVOoARoST3mrC 0HVPgSsba370fs+xaDMq =A4i0 -----END PGP SIGNATURE----- --Apple-Mail=_A30FD057-777E-426D-8CA2-9C5E11335E61--