emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] [babel] current directory and remote execution


From: Dan Davison
Subject: [Orgmode] [babel] current directory and remote execution
Date: Wed, 03 Mar 2010 23:25:41 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

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 /address@hidden:/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




reply via email to

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