emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] remote plot with local output?


From: Benda Xu
Subject: Re: [O] remote plot with local output?
Date: Tue, 15 Sep 2015 17:28:43 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Hi Charles,

"Charles C. Berry" <address@hidden> writes:

> Look at the :post header arg
>
>       (info "(org) post")
>
> You write a src block that extracts the remote file name from *this*,
> creates a local file name from it, copies the remote file to the local
> host, then substitutes the local file name in *this* and uses it as
> the return value.
>
> Use the name of that src block as the argument to :post

Thanks for your hint.  I come up with the following example:

   #+NAME: line
   | 1 |
   | 2 |
   | 3 |

   #+name: localize
   #+BEGIN_SRC emacs-lisp :var file="" dir=""
     (let ((rfile (concat (file-name-as-directory dir) file)))
       (let ((lfile (car (last (split-string rfile ":")))))
         (copy-file rfile lfile 1)
         lfile))
   #+END_SRC
   
   #+HEADER: :post localize(*this*, "/ipmuap02:/tmp")
   #+BEGIN_SRC python :results file :var dt=line :dir /ipmuap02:/tmp
     from matplotlib import pylab as plt
     plt.plot(dt)
     plt.savefig("line.png")
     return "line.png"
   #+END_SRC

   #+RESULTS:
   [[file:/tmp/line.png]]

*this* only returns the resulting file name, without :dir.  I have to
set the same remote directory again in the :post call.  Is there a
smarter way to achieve it without duplication?

Cheers,
Benda



reply via email to

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