emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] caching and code execution on export


From: Ista Zahn
Subject: [O] caching and code execution on export
Date: Fri, 1 Jul 2011 12:08:01 -0400

Hi all,
I'm giving org-babel another go after a recent retreat back to Sweave.
I'm having problems with code being executed on export, even when
:cache yes is in force. Please see the following example. Also, a
quick question that I can't seem to find the answer to: what is the
difference between "#+source <name>" and  "#+srcname <name>"?

Thanks!
Ista

============= 8< ============= example starts here <============= 8<
=============
#+BABEL: :session *R*

* Org-babel cache test

** Instructions
1. Start emacs in quiet mode (to rule out personal setting changing
   the results).
2. Evaluate the buffer and save it.
3. Evaluate it again.
4. Now export (e.g., to html) the buffer.

** Setup
*** load ess
#+source start-ess
#+begin_src emacs-lisp :results silent :exports none
  (require 'ess-site)
#+end_src

*** Setup bable for R
#+source setup-r-babel
#+begin_src emacs-lisp :results silent :exports none
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((R . t)))
#+end_src

** Test
*** First R code block
#+source: obtest
#+begin_src R :cache yes
  x <- rnorm(10)
  Sys.sleep(5)
#+end_src

*** Second R code block
#+source obtest2
#+begin_src R :cache yes
  y <-  10
  Sys.sleep(5)
#+end_src

** What happens
Cached code blocks are not re-exectued in step 3, as
intented. However, they are exectued in step 4. After much pain I
found that setting org-export-babel-evaluate to nil fixed the
problem. But a) I don't think this is the intended behavior, and b) if
it is I think it should be changed. I've seen the discussion at
http://comments.gmane.org/gmane.emacs.orgmode/40685 which
seems to indicate that this should not be happening.

** Version Info
GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) of 2011-04-11
Org-mode version 7.4 (same thing on 7.5 from ELPA)

============= 8< ============= example ends here <============= 8< =============
-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]