emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [PATCH] * lisp/ob-core.el (org-babel-execute-src-block): insert


From: Aaron Ecay
Subject: Re: [O] [PATCH] * lisp/ob-core.el (org-babel-execute-src-block): insert hash for silent results
Date: Tue, 12 Mar 2013 23:55:22 -0400
User-agent: Notmuch/0.15.2+43~ge848af8 (http://notmuchmail.org) Emacs/24.3.50.1 (x86_64-unknown-linux-gnu)

Hi Eric,

2013ko martxoak 9an, Eric Schulte-ek idatzi zuen:
> Could something like the following work?  Removing ":results none" and
> adding something small as the returned result which may easily be parsed
> and placed in the buffer w/o problem.
> 
>     #+begin_src R :cache yes
>       # code to perform side effect
>       x <- 'side effect'
>       'done'
>     #+end_src
> 
>     #+RESULTS[9f4e5b4b07e93c680ab37fc4ba1f75e1bfc0ee0a]:
>     : done

It works, but it is a kludge.  In fact, it is the same kludge that we
used to need before :results none (to avoid emacs choking on reading a
monster data frame).


> This does not need special built in support, e.g.,
> 
>     #+name: R-pid
>     #+begin_src sh :var R="/usr/lib64/R/bin/exec/R"
>       ps auxwww|grep "$R"|grep -v 'grep'|awk '{print $2}'
>     #+end_src
> 
>     #+begin_src R :cache yes :var pid=R-pid
>       # code to perform side effect
>       x <- 'side effect'
>       'done'
>     #+end_src
> 
>     #+RESULTS[da16f09882a6295815db51247592b77c80ed0056]:
>     : done

Now *this* is a kludge!  Since babel involves executing arbitrary code,
the question to ask is not “Is this possible in babel?”.  The answer is
always “yes.”  The right question is instead “What does it make the most
sense for babel to do?”  I think Achim’s contributions to this thread
pushing us in the direction of thinking about what the execution model
is are exactly what is needed.

For cached code running in a session, I think a sensible model is:
- Code should be re-run once after each session startup
- Other than that, code should be re-run only if it changes, or if the
  user explicitly requests it to be re-run.

In order to implement this, it is necessary to figure out how to hash
the contents of :results none blocks, and include the session process id
in the hash.  If you have a different model in mind, then you will want
different behavior.  But I think (thanks to Achim’s clarifying comments)
we can’t really discuss what is the “right” behavior without also
discussing which is the “right” model.

-- 
Aaron Ecay



reply via email to

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