emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: emacs-orgmode@gnu.org
Subject: Re: [bug] cannot extract just one column of table for use in gnuplot src block
Date: Sun, 23 Mar 2014 18:51:30 +0100	[thread overview]
Message-ID: <87bnwwst0d.fsf@Rainer.invalid> (raw)
In-Reply-To: 871txs2a3o.fsf@ucl.ac.uk

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	other threads:[~2014-03-23 17:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-23 15:44 [bug] cannot extract just one column of table for use in gnuplot src block Eric S Fraga
2014-03-23 17:51 ` Achim Gratz [this message]
2014-03-24  8:22   ` Eric S Fraga
2014-03-24 13:57     ` Bastien
2014-03-25 18:04       ` Achim Gratz
2014-03-25 20:59         ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bnwwst0d.fsf@Rainer.invalid \
    --to=stromeko@nexgo.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).