Browse Source

ob-gnuplot: create a proper table even when handed just a vector

* lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars):
  `org-babel-gnuplot-table-to-data´ expects a table, so we need to
  construct one when Babel hands us a vector.

Thanks to Eric Fraga for reporting the bug.
http://permalink.gmane.org/gmane.emacs.orgmode/84072
Achim Gratz 7 years ago
parent
commit
e89adba685
1 changed files with 9 additions and 4 deletions
  1. 9 4
      lisp/ob-gnuplot.el

+ 9 - 4
lisp/ob-gnuplot.el

@@ -85,10 +85,15 @@ code."
      (lambda (pair)
        (cons
 	(car pair) ;; variable name
-	(if (listp (cdr pair)) ;; variable value
-	    (org-babel-gnuplot-table-to-data
-	     (cdr pair) (org-babel-temp-file "gnuplot-") params)
-	  (cdr pair))))
+	(let* ((val (cdr pair)) ;; variable value
+	       (lp  (listp val)))
+	  (if lp
+	      (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))))
      (mapcar #'cdr (org-babel-get-header params :var)))))
 
 (defun org-babel-expand-body:gnuplot (body params)