emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Leo Alekseyev <dnquark@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: org-babel order of evaluation
Date: Fri, 20 Jan 2012 11:58:57 -0600	[thread overview]
Message-ID: <CADzxs1=juJXkwMHSN38SGay8KPMcS6DWv=j6NzTac6fszpcv7A@mail.gmail.com> (raw)
In-Reply-To: <20120113015244.GA27002@BigDog.local>

[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]

On Thu, Jan 12, 2012 at 7:52 PM, Rick Frankel <rick@rickster.com> wrote:
> On Thu, Jan 12, 2012 at 06:07:41PM -0700, Eric Schulte wrote:
>> Rick Frankel <rick@rickster.com> writes:
>>
>> Turns out it was not that difficult to change this behavior.  You and
>> Leo are both correct that in-buffer-order evaluation is more natural and
>> expected than the previous behavior.  I've just pushed up a fix after
>> which evaluating the following

Eric,
The fix doesn't seem to be working for me when I export the buffer to
HTML.  The ordering of call and source blocks once again becomes
randomized, and in general, exported file is missing a bunch of stuff
unless I run org-babel-execute-buffer prior to export.  Since the
export engine does its own evaluation, it doesn't seem like
org-babel-execute-buffer should be a necessity.  But I can't run
org-babel-execute-buffer on anything with a src_<language> inline
block as it gives me an error.

I'm attaching two files which do not export correctly, at least when
one doesn't run org-babel-execute-buffer; just do C-c C-e h and look
at the output.

--Leo

[-- Attachment #2: test-export4.org --]
[-- Type: application/octet-stream, Size: 1101 bytes --]

#+property: session *R-babel*

* export fail

#+NAME: elo_sim_analysis
#+HEADER: :var idx=1 :var print="TRUE" :var plot.filename="conv1.png" :var plot.disp="FALSE"
#+BEGIN_SRC R :results output replace 
  if (print == TRUE) {cat("some output\n")}
  
  img.dir = "images"
  cat.fname.link <- function() { cat(img.dir,"/",plot.filename,"\n",sep="") } 
  
  cat(img.dir,"/",plot.filename,"\n",sep="")
  
#+END_SRC


Should have all conv1 stuff

#+call: elo_sim_analysis(idx=1,print="TRUE",plot.filename="conv1.png",plot.disp="FALSE")

src_R[:results output replace]{ cat.fname.link() }

Should have all conv2 stuff 

#+call: elo_sim_analysis(idx=8,print="TRUE",plot.filename="conv2.png",plot.disp="FALSE")

src_R[:results output replace]{ cat.fname.link() } 

Should have all conv3 stuff
#+call: elo_sim_analysis(idx=1,print="TRUE",plot.filename="conv3.png",plot.disp="FALSE")

src_R[:results output replace]{ cat.fname.link() } 

Should have all conv4 stuff

#+call: elo_sim_analysis(idx=1,print="TRUE",plot.filename="conv4.png",plot.disp="FALSE")

src_R[:results output replace]{ cat.fname.link() } 



[-- Attachment #3: test-export6.org --]
[-- Type: application/octet-stream, Size: 1573 bytes --]


#+startup: noindent
#+property: session *R-babel*
#+property: tangle yes

* code

#+NAME: elo_sim_analysis
#+HEADER: :var idx=1 :var print="TRUE" :var plot.filename="conv1.png" :var plot.disp="FALSE"
#+BEGIN_SRC R :results output replace 
  gen.sample.plots <- function(idx) {
    hist(rnorm(100))
    title(paste("Plot for index ",idx, sep=""))
  }
  
  if (print == TRUE) {cat("some output\n")}
  
  img.dir = "images"
  cat.fname.link <- function() { cat("\nfile:",img.dir,"/",plot.filename,"\n",sep="") } 
  
  cat("file:",img.dir,"/",plot.filename,"\n",sep="")
  
#+END_SRC

#+RESULTS: elo_sim_analysis
:  some output
:  file:images/conv1.png

#+NAME: gen_link
#+HEADER: :var plot.filename="conv1.png" 
#+BEGIN_SRC R :results output replace 
  img.dir = "images"
  cat.fname.link <- function() { cat("\nfile:",img.dir,"/",plot.filename,"\n",sep="") } 
  cat.fname.link()
#+END_SRC

* ordered execution fail

Should have all conv1 stuff

#+call: elo_sim_analysis(idx=1,print="TRUE",plot.filename="conv1.png",plot.disp="FALSE")

#+call: gen_link(plot.filename="conv1.png")

Should have all conv2 stuff 

#+call: elo_sim_analysis(idx=8,print="TRUE",plot.filename="conv2.png",plot.disp="FALSE")

#+call: gen_link(plot.filename="conv2.png")

Should have all conv3 stuff

#+call: elo_sim_analysis(idx=1,print="TRUE",plot.filename="conv3.png",plot.disp="FALSE")

#+call: gen_link(plot.filename="conv3.png")

Should have all conv4 stuff

#+call: elo_sim_analysis(idx=1,print="TRUE",plot.filename="conv4.png",plot.disp="FALSE")

#+call: gen_link(plot.filename="conv4.png")




  reply	other threads:[~2012-01-20 17:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-12  0:25 org-babel order of evaluation Rick Frankel
2012-01-12 14:43 ` Eric Schulte
2012-01-12 22:35   ` Leo Alekseyev
2012-01-12 22:51     ` Rick Frankel
2012-01-13  1:07       ` Eric Schulte
2012-01-13  1:52         ` Rick Frankel
2012-01-20 17:58           ` Leo Alekseyev [this message]
2012-01-23 17:56             ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADzxs1=juJXkwMHSN38SGay8KPMcS6DWv=j6NzTac6fszpcv7A@mail.gmail.com' \
    --to=dnquark@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).