From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benda Xu Subject: Re: remote plot with local output? Date: Tue, 15 Sep 2015 17:28:43 +0900 Message-ID: <871te0cchw.fsf@gentoo.org> References: <87bnd5gho8.fsf@gentoo.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zblar-00041B-Qu for emacs-orgmode@gnu.org; Tue, 15 Sep 2015 04:28:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zblao-0005sa-Ln for emacs-orgmode@gnu.org; Tue, 15 Sep 2015 04:28:01 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:32953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zblao-0005s9-Gz for emacs-orgmode@gnu.org; Tue, 15 Sep 2015 04:27:58 -0400 Received: from proton (www20427ue.sakura.ne.jp [49.212.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: heroxbd) by smtp.gentoo.org (Postfix) with ESMTPSA id 20AC23409A4 for ; Tue, 15 Sep 2015 08:27:56 +0000 (UTC) In-Reply-To: (Charles C. Berry's message of "Mon, 14 Sep 2015 13:42:55 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Charles, "Charles C. Berry" 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