A quick note about a new org-babel feature:

You can now use header argument :dir to alter the directory that is
current when code is executed. The directory may be a location on a
remote machine, specified using tramp syntax[1]. In this case the code
will be executed on the remote machine.

If a relative path for file output is supplied using :file, then it will
be interpreted relative to the altered current directory. But while file
output may be created on a remote machine, numeric/text results are
returned to the local buffer as normal.

The :dir header arg will affect most languages; retrieval of remote
results is currently available for shell, R, ruby, python, perl and
clojure. New sessions can use :dir (and can be remote), but pre-existing
sessions are currently unaffected by :dir.

Here's an example of running code remotely:

#+begin_src sh :dir /davi...@oak.somewhere.uk:/tmp :results output
echo "Executed by `whoami` on `hostname` in `pwd`"
#+end_src

#+results:
: Executed by davison on oak in /tmp

And here's an example of mixing a relative :file path with :dir

#+begin_src R :file images/1.png :dir ~/project
plot(1:10)
#+end_src

#+results:
[[file:/home/dan/project/images/1.png]]

Further documentation at [2].

Dan

Footnotes:

[1] http://www.gnu.org/software/tramp/#Filename-Syntax

[2] http://orgmode.org/worg/org-contrib/babel/reference.php#header-argument-dir


_______________________________________________
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

Reply via email to