emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Suppressing src block evaluationon publish?
@ 2011-02-01 15:56 Loris Bennett
  2011-02-01 16:06 ` Erik Iverson
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Loris Bennett @ 2011-02-01 15:56 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I have an org file containing several src blocks which generate images
using ditaa. When I publish to PDF via LaTeX, the images are all
generated every time, which makes publishing rather slow.

Is there some way to toggle the evaluation of the src blocks on and off
when the file is published?

Thanks

Loris

-- 
Dr. Loris Bennett
ZEDAT Computer Centre
Freie Universität Berlin
Berlin, Germany

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suppressing src block evaluationon publish?
  2011-02-01 15:56 Suppressing src block evaluationon publish? Loris Bennett
@ 2011-02-01 16:06 ` Erik Iverson
  2011-02-03  8:19   ` Loris Bennett
  2011-02-01 16:35 ` Andrea Crotti
  2011-02-01 16:37 ` Andrea Crotti
  2 siblings, 1 reply; 8+ messages in thread
From: Erik Iverson @ 2011-02-01 16:06 UTC (permalink / raw)
  To: Loris Bennett; +Cc: emacs-orgmode



Loris Bennett wrote:
> Hi,
> 
> I have an org file containing several src blocks which generate images
> using ditaa. When I publish to PDF via LaTeX, the images are all
> generated every time, which makes publishing rather slow.
> 
> Is there some way to toggle the evaluation of the src blocks on and off
> when the file is published?
> 

You could try the :cache header argument, http://orgmode.org/org.html#cache

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suppressing src block evaluationon publish?
  2011-02-01 15:56 Suppressing src block evaluationon publish? Loris Bennett
  2011-02-01 16:06 ` Erik Iverson
@ 2011-02-01 16:35 ` Andrea Crotti
  2011-02-01 16:37 ` Andrea Crotti
  2 siblings, 0 replies; 8+ messages in thread
From: Andrea Crotti @ 2011-02-01 16:35 UTC (permalink / raw)
  To: emacs-orgmode

Loris Bennett <loris.bennett@fu-berlin.de> writes:

> Hi,
>
> I have an org file containing several src blocks which generate images
> using ditaa. When I publish to PDF via LaTeX, the images are all
> generated every time, which makes publishing rather slow.
>
> Is there some way to toggle the evaluation of the src blocks on and off
> when the file is published?
>
> Thanks
>
> Loris

What I do 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suppressing src block evaluationon publish?
  2011-02-01 15:56 Suppressing src block evaluationon publish? Loris Bennett
  2011-02-01 16:06 ` Erik Iverson
  2011-02-01 16:35 ` Andrea Crotti
@ 2011-02-01 16:37 ` Andrea Crotti
  2 siblings, 0 replies; 8+ messages in thread
From: Andrea Crotti @ 2011-02-01 16:37 UTC (permalink / raw)
  To: emacs-orgmode

Loris Bennett <loris.bennett@fu-berlin.de> writes:

> Hi,
>
> I have an org file containing several src blocks which generate images
> using ditaa. When I publish to PDF via LaTeX, the images are all
> generated every time, which makes publishing rather slow.
>
> Is there some way to toggle the evaluation of the src blocks on and off
> when the file is published?
>
> Thanks
>
> Loris

Sorry for the other mail I pressed a C-c C-c too much.
What I do normally is to put the graphs in another file and then include
only the link in the file that I want to export.

In case I change something I can still remember to do C-c C-c on the
graph...

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suppressing src block evaluationon publish?
  2011-02-01 16:06 ` Erik Iverson
@ 2011-02-03  8:19   ` Loris Bennett
  2011-02-03 10:38     ` Dan Davison
  0 siblings, 1 reply; 8+ messages in thread
From: Loris Bennett @ 2011-02-03  8:19 UTC (permalink / raw)
  To: emacs-orgmode

Erik Iverson <eriki@ccbr.umn.edu> writes:

> Loris Bennett wrote:
>> Hi,
>>
>> I have an org file containing several src blocks which generate images
>> using ditaa. When I publish to PDF via LaTeX, the images are all
>> generated every time, which makes publishing rather slow.
>>
>> Is there some way to toggle the evaluation of the src blocks on and off
>> when the file is published?
>>
>
> You could try the :cache header argument, http://orgmode.org/org.html#cache
>

Ah, thanks. There is a slight gotcha here, though.

I added :cache yes to the source headers and exported again, but nothing
changed; all the images were generated again. Also, no SHA1 hash was
added to the +results header.

After some fruitless fiddling I was about to write to the list again and
moan, when I did a slightly random C-c C-c in the begin_src line and,
hey presto, the hash was added to the results header. I then did this
for all the images and found that the image were no longer regenerated
on export, as advertised.

Perhaps the documentation of :cache could be extended to mention the
necessity of evaluating the source block before exporting.

Loris
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

-- 
Dr. Loris Bennett
ZEDAT Computer Centre
Freie Universität Berlin
Berlin, Germany

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Suppressing src block evaluationon publish?
  2011-02-03  8:19   ` Loris Bennett
@ 2011-02-03 10:38     ` Dan Davison
  2011-02-03 14:34       ` Eric Schulte
  0 siblings, 1 reply; 8+ messages in thread
From: Dan Davison @ 2011-02-03 10:38 UTC (permalink / raw)
  To: Loris Bennett; +Cc: emacs-orgmode

Loris Bennett <loris.bennett@fu-berlin.de> writes:

> Erik Iverson <eriki@ccbr.umn.edu> writes:
>
>> Loris Bennett wrote:
>>> Hi,
>>>
>>> I have an org file containing several src blocks which generate images
>>> using ditaa. When I publish to PDF via LaTeX, the images are all
>>> generated every time, which makes publishing rather slow.
>>>
>>> Is there some way to toggle the evaluation of the src blocks on and off
>>> when the file is published?
>>>
>>
>> You could try the :cache header argument, http://orgmode.org/org.html#cache
>>
>
> Ah, thanks. There is a slight gotcha here, though.
>
> I added :cache yes to the source headers and exported again, but nothing
> changed; all the images were generated again. Also, no SHA1 hash was
> added to the +results header.
>
> After some fruitless fiddling I was about to write to the list again and
> moan, when I did a slightly random C-c C-c in the begin_src line and,
> hey presto, the hash was added to the results header. I then did this
> for all the images and found that the image were no longer regenerated
> on export, as advertised.

Hi Loris,

Yes. It does seem that it would be nice if in this situation, the first
export added the SHA1s, and subsequent exports recognized that
evaluation wasn't required. I think the reason this does not happen is
that behind-the-scenes Org makes a copy of the buffer for export
preprocessing (including src block evaluation). But Eric S is the expert
-- he may have more to say here.

A couple of things that might be relevant here: the variable
`org-export-babel-evaluate' can also be used to prevent evaluation on
export (but the :cache approach has advantages). And C-c C-v C-b / C-c
C-v C-s (`org-babel-evaluate-buffer' / `org-babel-execute-subtree')
could be used to update the SHA1s.

> Perhaps the documentation of :cache could be extended to mention the
> necessity of evaluating the source block before exporting.

I've added that to the TODO list.

Dan


>

>
> Loris
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Re: Suppressing src block evaluationon publish?
  2011-02-03 10:38     ` Dan Davison
@ 2011-02-03 14:34       ` Eric Schulte
  2011-02-17 17:09         ` Andreas Leha
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Schulte @ 2011-02-03 14:34 UTC (permalink / raw)
  To: Dan Davison; +Cc: Loris Bennett, emacs-orgmode

Dan Davison <dandavison7@gmail.com> writes:

> Loris Bennett <loris.bennett@fu-berlin.de> writes:
>
>> Erik Iverson <eriki@ccbr.umn.edu> writes:
>>
>>> Loris Bennett wrote:
>>>> Hi,
>>>>
>>>> I have an org file containing several src blocks which generate images
>>>> using ditaa. When I publish to PDF via LaTeX, the images are all
>>>> generated every time, which makes publishing rather slow.
>>>>
>>>> Is there some way to toggle the evaluation of the src blocks on and off
>>>> when the file is published?
>>>>
>>>
>>> You could try the :cache header argument, http://orgmode.org/org.html#cache
>>>
>>
>> Ah, thanks. There is a slight gotcha here, though.
>>
>> I added :cache yes to the source headers and exported again, but nothing
>> changed; all the images were generated again. Also, no SHA1 hash was
>> added to the +results header.
>>
>> After some fruitless fiddling I was about to write to the list again and
>> moan, when I did a slightly random C-c C-c in the begin_src line and,
>> hey presto, the hash was added to the results header. I then did this
>> for all the images and found that the image were no longer regenerated
>> on export, as advertised.
>
> Hi Loris,
>
> Yes. It does seem that it would be nice if in this situation, the first
> export added the SHA1s, and subsequent exports recognized that
> evaluation wasn't required. I think the reason this does not happen is
> that behind-the-scenes Org makes a copy of the buffer for export
> preprocessing (including src block evaluation). But Eric S is the expert
> -- he may have more to say here.
>

Yes, this is exactly the case.  Org-mode is very careful that the
process of exporting does not make any permanent changes to the original
org-mode file.  I agree this should be mentioned in the :cache
documentation.

Best -- Eric

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Re: Suppressing src block evaluationon publish?
  2011-02-03 14:34       ` Eric Schulte
@ 2011-02-17 17:09         ` Andreas Leha
  0 siblings, 0 replies; 8+ messages in thread
From: Andreas Leha @ 2011-02-17 17:09 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 3458 bytes --]

Hi all,

sorry to reopen this thread,  but this does not work for me (GNU Emacs
23.2.1, Org almost HEAD c7700d7bbee4f7596feb199b1ec1bc7750d4fb48)

For me the image in the attached example is always created during
(LaTeX)export.  Even if I do the manual evaluation once (and the hash is
created).

The manual re-evaluation respects the :cache yes and does not evaluate
again.

What am I missing?

- Andreas

================================

* Test
  Some text.
  #+srcname: some_code
  #+begin_src R :session :exports code :eval never
    mean <- 0
  #+end_src

  Some text.
  #+srcname: plot_code
  #+begin_src R :session :exports code :eval never
    plot(x=rnorm(1000000, mean=mean, sd=sd),
         y=rnorm(1000000, mean=mean, sd=sd))
  #+end_src


* Plots
  #+LABEL:      fig:test
  #+ATTR_LaTeX: height=.29\textheight
  #+srcname: plot_1
  #+begin_src R :session :noweb yes :file test.pdf  :exports results
:results graphics :width 8 :height 4 :cache yes
    sd <- 4
    <<some_code>>
   
    <<plot_code>>
  #+end_src

  #+results[17681e8e450f1f4e1d8f55fa57f9be1b24dae4db]: plot_1
  [[file:test.pdf]]
================================


Am 03.02.2011 15:34, schrieb Eric Schulte:
> Dan Davison <dandavison7@gmail.com> writes:
>
>   
>> Loris Bennett <loris.bennett@fu-berlin.de> writes:
>>
>>     
>>> Erik Iverson <eriki@ccbr.umn.edu> writes:
>>>
>>>       
>>>> Loris Bennett wrote:
>>>>         
>>>>> Hi,
>>>>>
>>>>> I have an org file containing several src blocks which generate images
>>>>> using ditaa. When I publish to PDF via LaTeX, the images are all
>>>>> generated every time, which makes publishing rather slow.
>>>>>
>>>>> Is there some way to toggle the evaluation of the src blocks on and off
>>>>> when the file is published?
>>>>>
>>>>>           
>>>> You could try the :cache header argument, http://orgmode.org/org.html#cache
>>>>
>>>>         
>>> Ah, thanks. There is a slight gotcha here, though.
>>>
>>> I added :cache yes to the source headers and exported again, but nothing
>>> changed; all the images were generated again. Also, no SHA1 hash was
>>> added to the +results header.
>>>
>>> After some fruitless fiddling I was about to write to the list again and
>>> moan, when I did a slightly random C-c C-c in the begin_src line and,
>>> hey presto, the hash was added to the results header. I then did this
>>> for all the images and found that the image were no longer regenerated
>>> on export, as advertised.
>>>       
>> Hi Loris,
>>
>> Yes. It does seem that it would be nice if in this situation, the first
>> export added the SHA1s, and subsequent exports recognized that
>> evaluation wasn't required. I think the reason this does not happen is
>> that behind-the-scenes Org makes a copy of the buffer for export
>> preprocessing (including src block evaluation). But Eric S is the expert
>> -- he may have more to say here.
>>
>>     
> Yes, this is exactly the case.  Org-mode is very careful that the
> process of exporting does not make any permanent changes to the original
> org-mode file.  I agree this should be mentioned in the :cache
> documentation.
>
> Best -- Eric
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>   



[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 6432 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-02-17 17:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-01 15:56 Suppressing src block evaluationon publish? Loris Bennett
2011-02-01 16:06 ` Erik Iverson
2011-02-03  8:19   ` Loris Bennett
2011-02-03 10:38     ` Dan Davison
2011-02-03 14:34       ` Eric Schulte
2011-02-17 17:09         ` Andreas Leha
2011-02-01 16:35 ` Andrea Crotti
2011-02-01 16:37 ` Andrea Crotti

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).