[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] org-babel order of evaluation
From: |
Eric Schulte |
Subject: |
Re: [O] org-babel order of evaluation |
Date: |
Thu, 12 Jan 2012 18:07:41 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
Rick Frankel <address@hidden> writes:
> On Thu, Jan 12, 2012 at 04:35:31PM -0600, Leo Alekseyev wrote:
>> >> Therefore, when executing an entire buffer, there is no way to have
>> >> the execution of a call block dependent on the prior execution of a
>> >> source block.
>> >>
>> >
>> > It would be better to make the dependency explicit by passing the
>> > results of the call line as a (potentially unused) variable to the code
>> > block. For example;
>> [snip]
>
> The problem w/ this is that the (potentially time consuming) dependent
> will be executed twice when doing a buffer eval.
>
>> > There is (at least currently) no guarantee that evaluation order will be
>> > buffer order.
>>
>> Is there some deep rationale for the current behavior that I'm not
>> seeing? Are there big obstacles to enforcing ligeral execution order?
>
> It's because prior to 7.8, call blocks were not executed during a
> buffer execute. The solution was to execute all the call blocks after
> executing the src block. (Eric would have to comment on how hard it
> would be to merge the two functions :).
>
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
#+Title: Execute all executables in Order
#+Property: results silent
#+name: foo
#+BEGIN_SRC sh :var it="one"
echo $it >> debug
#+END_SRC
#+call: foo("two")
#+BEGIN_SRC sh
echo "three" >> debug
#+END_SRC
results in the creation of a "debug" file in the same directory reading;
,----
| one
| two
| three
`----
Thanks for bringing this up,
>
> rick
>
--
Eric Schulte
http://cs.unm.edu/~eschulte/