From mboxrd@z Thu Jan 1 00:00:00 1970 From: bernardH Subject: Unable to reuse the result of a cached function call as argument of a gnuplot call Date: Wed, 10 Jun 2015 18:30:22 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2kqH-0005qR-5Q for emacs-orgmode@gnu.org; Wed, 10 Jun 2015 14:35:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2kqC-0002tk-3O for emacs-orgmode@gnu.org; Wed, 10 Jun 2015 14:35:13 -0400 Received: from plane.gmane.org ([80.91.229.3]:50715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2kqB-0002qV-TW for emacs-orgmode@gnu.org; Wed, 10 Jun 2015 14:35:08 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Z2kqA-0005Zz-8I for emacs-orgmode@gnu.org; Wed, 10 Jun 2015 20:35:06 +0200 Received: from nor75-4-81-56-59-216.fbx.proxad.net ([81.56.59.216]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Jun 2015 20:35:06 +0200 Received: from org-mode by nor75-4-81-56-59-216.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Jun 2015 20:35:06 +0200 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 all ! First, I would like to thank the org-mode community for the great fun I'm having with babel. Unfortunately, I'm currently stumped by what appears to be a bug (or unhandled corner-case). Here is a org-mode style write-up to describe the problem : * Versions #+BEGIN_SRC elisp (org-version) #+END_SRC #+RESULTS: : 8.3beta #+BEGIN_SRC elisp (emacs-version) #+END_SRC #+RESULTS: : GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.6) : of 2014-01-01 on prometheus, modified by Debian * Minimal (!) example Defining a function, I'll want to use the result of a _cached_ call as an arg to a a gnuplot function. #+name: fun #+BEGIN_SRC sh :var nb="10" :results output seq $(( ${nb} * 2 )) | paste - - #+END_SRC First a regular call, to show that I'll be able to reuse the result of this call. #+name: my-call #+call: fun[:results table](nb=5) #+RESULTS: my-call | 1 | 2 | | 3 | 4 | | 5 | 6 | | 7 | 8 | | 9 | 10 | Now a cached call. #+name: my-call-cached #+call: fun[:results table](nb=5) :cache yes #+RESULTS[f2b650eb5296f72a1f7237c2a65b7fb3443acf5f]: my-call-cached | 1 | 2 | | 3 | 4 | | 5 | 6 | | 7 | 8 | | 9 | 10 | Dummy data that I only use as default value for the gnuplot function definition. #+name:dummy-data | 1 | 2 | #+name: plotting #+begin_src gnuplot :var data=dummy-data my_title="dummy title" :file dummy.png set title my_title plot data #+end_src #+RESULTS: plotting [[file:dummy.png]] I can call the gnuplot function on the result of the uncached call : #+name: plot-result #+call: plotting[:file result-call.png](data= my-call) :results file #+RESULTS: plot-result [[file:result-call.png]] #+BEGIN_SRC sh :results output file result-call.png #+END_SRC #+RESULTS: : result-call.png: PNG image data, 640 x 480, 8-bit colormap, non-interlaced But if I try to use the cached call : #+name: plot-result-cached #+call: plotting[:file result-call-cached.png](data= my-call-cached) :results file #+RESULTS: plot-result-cached [[file:result-call-cached.png]] #+BEGIN_SRC sh file result-call-cached.png #+END_SRC #+RESULTS: : result-call-cached.png: empty * gnuplot console Working gnuplot invocation had : #+BEGIN_EXAMPLE gnuplot> data = "/tmp/babel-262957O1/gnuplot-26295F9G" #+END_EXAMPLE Failed invocation on result of a cached call had : #+BEGIN_EXAMPLE gnuplot> data = "((1 2) (3 4) (5 6) (7 8) (9 10))" gnuplot> set term png Terminal type set to 'png' Options are 'nocrop font "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf,12" fontscale 1.0 size 640,480 ' gnuplot> set output "result-call-cached.png" gnuplot> set title my_title gnuplot> plot data warning: Skipping unreadable file "((1 2) (3 4) (5 6) (7 8) (9 10))" No data in plot #+END_EXAMPLE * References [[https://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg01379.html][message on arg passing to gnuplot]] [[http://emacs.stackexchange.com/a/12690/8545][stackexchange answer pointing to the implementation of the results of named function calls as arguments]] Thank you very much if a fix is possible (I really need to cache the very expensive function calls of my real use-case, but I should be able to make a cheap uncached identity function before the gnuplot invocation as a workaround). Best Regards, Bernard