From mboxrd@z Thu Jan 1 00:00:00 1970 From: tsd@tsdye.com (Thomas S. Dye) Subject: Re: Only evaluate code blocks interactively, but export results Date: Sat, 04 Apr 2015 07:15:51 -1000 Message-ID: References: <0119590B-CC3F-4CAF-85E6-E736C6755AB2@block-party.net> 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]:57196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YeRg6-0002EK-Ge for emacs-orgmode@gnu.org; Sat, 04 Apr 2015 13:16:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YeRg3-0006e9-98 for emacs-orgmode@gnu.org; Sat, 04 Apr 2015 13:16:14 -0400 Received: from gproxy4-pub.mail.unifiedlayer.com ([69.89.23.142]:48625) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1YeRg3-0006e1-1u for emacs-orgmode@gnu.org; Sat, 04 Apr 2015 13:16:11 -0400 In-Reply-To: <0119590B-CC3F-4CAF-85E6-E736C6755AB2@block-party.net> (David Dynerman's message of "Sat, 4 Apr 2015 12:03:14 -0500") 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: David Dynerman Cc: emacs-orgmode@gnu.org Aloha David, David Dynerman 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 co= de > 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 --=20 Thomas S. Dye http://www.tsdye.com