]> code.delx.au - gnu-emacs/blobdiff - lisp/org/ob-gnuplot.el
Update copyright year to 2016
[gnu-emacs] / lisp / org / ob-gnuplot.el
index cc9186b1adcd2e9bdc839c9b38286e5f99d0997e..0dcb1ba6175950ab57d168e2d0e80fa9d29f6903 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ob-gnuplot.el --- org-babel functions for gnuplot evaluation
 
-;; Copyright (C) 2009-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2016 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
@@ -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)
@@ -253,7 +258,7 @@ then create one.  Return the initialized session.  The current
        (org-babel-gnuplot-quote-timestamp-field s)
       (if (zerop (length s))
          (or *org-babel-gnuplot-missing* s)
-       (if (string-match "[ \"]" "?")
+       (if (string-match "[ \"]" s)
            (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"")
                    "\"")
          s)))))