>From 6e72396c6d5b280be900676fdcddcb14cdaf2f60 Mon Sep 17 00:00:00 2001 From: Thierry Banel Date: Tue, 3 Jan 2017 22:24:07 +0100 Subject: [PATCH] ob-gnuplot: temp files generated only once * lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars): still called multiple times but caches temporary files generation --- lisp/ob-gnuplot.el | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el index e91e05a..76d47fd 100644 --- a/lisp/ob-gnuplot.el +++ b/lisp/ob-gnuplot.el @@ -84,15 +84,17 @@ code." (lambda (pair) (cons (car pair) ;; variable name - (let* ((val (cdr pair)) ;; variable value - (lp (listp val))) - (if lp + (let ((val (cdr pair))) ;; variable value + (if (not (listp val)) + val + (let ((temp-file (org-babel-temp-file "gnuplot-")) + (first (car val))) + (setcdr pair temp-file) ;; <------ caching here (org-babel-gnuplot-table-to-data - (let* ((first (car val)) - (tablep (or (listp first) (symbolp first)))) - (if tablep val (mapcar 'list val))) - (org-babel-temp-file "gnuplot-") params) - val)))) + (if (or (listp first) (symbolp first)) + val + (mapcar 'list val)) + temp-file params)))))) (org-babel--get-vars params)))) (defun org-babel-expand-body:gnuplot (body params) -- 2.1.4