From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: [babel] current directory and remote execution Date: Wed, 03 Mar 2010 23:25:41 +0000 Message-ID: <87hboxvvgq.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nmxws-00010g-2j for emacs-orgmode@gnu.org; Wed, 03 Mar 2010 18:25:50 -0500 Received: from [140.186.70.92] (port=58001 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nmxwr-00010Y-8D for emacs-orgmode@gnu.org; Wed, 03 Mar 2010 18:25:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nmxwq-000857-8V for emacs-orgmode@gnu.org; Wed, 03 Mar 2010 18:25:49 -0500 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:64407) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nmxwp-00084z-Ut for emacs-orgmode@gnu.org; Wed, 03 Mar 2010 18:25:48 -0500 Received: from blackcap.stats.ox.ac.uk (blackcap.stats [163.1.210.5]) by markov.stats.ox.ac.uk (8.13.6/8.13.6) with ESMTP id o23NPks5002814 for ; Wed, 3 Mar 2010 23:25:46 GMT List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs org-mode mailing list 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 /davison@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