emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [bug] cannot extract just one column of table for use in gnuplot


From: Achim Gratz
Subject: Re: [O] [bug] cannot extract just one column of table for use in gnuplot src block
Date: Sun, 23 Mar 2014 18:51:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Eric S Fraga writes:
> The trace shows that the column has been extracted exactly as I
> wish.

No, the column has been extracted as a vector, not a table.

> However, it would appear that the function may expect a sequence
> and not just a single element?

A table line is a list or a symbol, at the point of the error only a
list may be present.  However, due to "data" being a vector, you'll get
a number.  That's easy enough to guard for in that function, but the bug
is much further up the call chain, most likely in
org-babel-gnuplot-process-vars.  Something along the line of the
following patch might be in order:

diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el
index 6783706..7d7db2a 100644
--- a/lisp/ob-gnuplot.el
+++ b/lisp/ob-gnuplot.el
@@ -85,10 +85,15 @@ (defun org-babel-gnuplot-process-vars (params)
      (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)))))


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf Blofeld V1.15B11:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




reply via email to

[Prev in Thread] Current Thread [Next in Thread]