* [bug] cannot extract just one column of table for use in gnuplot src block
@ 2014-03-23 15:44 Eric S Fraga
2014-03-23 17:51 ` Achim Gratz
0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2014-03-23 15:44 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 35 bytes --]
Hello,
with this simple example,
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: examplebug.org --]
[-- Type: text/x-org, Size: 834 bytes --]
#+TITLE: examplebug.org
#+AUTHOR: Eric S Fraga
* table references
#+tblname: mytable
| | A | B | C | D | E | F | G | H | I | Total |
|---+---+---+---+---+---+---+---+---+---+-------|
| 1 | 1 | 1 | | | 0 | | | 1 | | 3 |
| 2 | 1 | | | | 0 | | | 1 | | 2 |
| 3 | | | 2 | 1 | 0 | | | 1 | | 4 |
| 4 | | | 2 | 1 | | | | 1 | | 4 |
| 5 | | | 2 | | | | | | | 2 |
| 6 | | | | | | 1 | | | | 1 |
| 7 | | | | | | | 0 | | | 0 |
| 8 | | | | | | | | | 2 | 2 |
|---+---+---+---+---+---+---+---+---+---+-------|
#+TBLFM: $1=1+@-1::$11=vsum($2..$10)
#+begin_src gnuplot :var data=mytable[1:-1,10] :file histogram.pdf
set xrange [-0.5:25.5]
set yrange [0:4.2]
plot data with histograms notitle
#+end_src
[-- Attachment #3: Type: text/plain, Size: 710 bytes --]
where I am trying to plot out the last column using a histogram plot in
gnuplot, org fails with an error:
Debugger entered--Lisp error: (wrong-type-argument sequencep 3)
where the last function invoked was "orgtbl-format-line(3)".
The trace is attached. This is with org up to date as of a few minutes ago.
The trace shows that the column has been extracted exactly as I
wish. However, it would appear that the function may expect a sequence
and not just a single element? If I try to extract more than just one
column, everything is fine (although obviously the gnuplot directives
need to change...).
thanks,
eric
--
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.2, Org release_8.2.5h-831-gcb9172-git
[-- Attachment #4: trace.txt --]
[-- Type: text/plain, Size: 17234 bytes --]
Debugger entered--Lisp error: (wrong-type-argument sequencep 3)
mapcar((lambda (f) (setq i (1+ i)) (let* ((efmt (orgtbl-get-fmt *orgtbl-efmt* i)) (f (if (and efmt (string-match orgtbl-exp-regexp f)) (orgtbl-apply-fmt efmt (match-string 1 f) (match-string 2 f)) f))) (orgtbl-apply-fmt (or (orgtbl-get-fmt *orgtbl-fmt* i) *orgtbl-default-fmt*) f))) 3)
(let* ((i 0) (line (mapcar (function (lambda (f) (setq i (1+ i)) (let* (... ...) (orgtbl-apply-fmt ... f)))) line))) (setq *orgtbl-rtn* (cons (if *orgtbl-lfmt* (apply (function orgtbl-apply-fmt) *orgtbl-lfmt* line) (concat (orgtbl-eval-str *orgtbl-lstart*) (mapconcat (quote identity) line *orgtbl-sep*) (orgtbl-eval-str *orgtbl-lend*))) *orgtbl-rtn*)))
(if (eq line (quote hline)) (if *orgtbl-hline* (setq *orgtbl-rtn* (cons *orgtbl-hline* *orgtbl-rtn*))) (let* ((i 0) (line (mapcar (function (lambda (f) (setq i ...) (let* ... ...))) line))) (setq *orgtbl-rtn* (cons (if *orgtbl-lfmt* (apply (function orgtbl-apply-fmt) *orgtbl-lfmt* line) (concat (orgtbl-eval-str *orgtbl-lstart*) (mapconcat (quote identity) line *orgtbl-sep*) (orgtbl-eval-str *orgtbl-lend*))) *orgtbl-rtn*))))
orgtbl-format-line(3)
(if prevline (orgtbl-format-line prevline))
(while (not (eq (car *orgtbl-table*) section-stopper)) (if prevline (orgtbl-format-line prevline)) (setq prevline (car-safe (prog1 *orgtbl-table* (setq *orgtbl-table* (cdr *orgtbl-table*))))))
(progn (while (not (eq (car *orgtbl-table*) section-stopper)) (if prevline (orgtbl-format-line prevline)) (setq prevline (car-safe (prog1 *orgtbl-table* (setq *orgtbl-table* (cdr *orgtbl-table*)))))) (if prevline (let ((*orgtbl-lstart* *orgtbl-llstart*) (*orgtbl-lend* *orgtbl-llend*) (*orgtbl-lfmt* *orgtbl-llfmt*)) (orgtbl-format-line prevline))))
(let (prevline) (progn (while (not (eq (car *orgtbl-table*) section-stopper)) (if prevline (orgtbl-format-line prevline)) (setq prevline (car-safe (prog1 *orgtbl-table* (setq *orgtbl-table* (cdr *orgtbl-table*)))))) (if prevline (let ((*orgtbl-lstart* *orgtbl-llstart*) (*orgtbl-lend* *orgtbl-llend*) (*orgtbl-lfmt* *orgtbl-llfmt*)) (orgtbl-format-line prevline)))))
orgtbl-format-section(nil)
(let* ((splicep (plist-get params :splice)) (hline (plist-get params :hline)) (skipheadrule (plist-get params :skipheadrule)) (remove-nil-linesp (plist-get params :remove-nil-lines)) (remove-newlines (plist-get params :remove-newlines)) (*orgtbl-hline* hline) (*orgtbl-table* table) (*orgtbl-sep* (plist-get params :sep)) (*orgtbl-efmt* (plist-get params :efmt)) (*orgtbl-lstart* (plist-get params :lstart)) (*orgtbl-llstart* (or (plist-get params :llstart) *orgtbl-lstart*)) (*orgtbl-lend* (plist-get params :lend)) (*orgtbl-llend* (or (plist-get params :llend) *orgtbl-lend*)) (*orgtbl-lfmt* (plist-get params :lfmt)) (*orgtbl-llfmt* (or (plist-get params :llfmt) *orgtbl-lfmt*)) (*orgtbl-fmt* (plist-get params :fmt)) *orgtbl-rtn*) (if backend (progn (setq *orgtbl-table* (mapcar (function (lambda (r) (if ... ... r))) *orgtbl-table*)))) (if splicep nil (if (plist-member params :tstart) (progn (let ((tstart (orgtbl-eval-str ...))) (if tstart (setq *orgtbl-rtn* (cons tstart *orgtbl-rtn*))))))) (if (and (not splicep) (or (consp (car *orgtbl-table*)) (consp (nth 1 *orgtbl-table*))) (memq (quote hline) (cdr *orgtbl-table*))) (progn (if (eq (quote hline) (car *orgtbl-table*)) (progn (and hline (setq *orgtbl-rtn* (cons hline *orgtbl-rtn*))) (car-safe (prog1 *orgtbl-table* (setq *orgtbl-table* ...))))) (let* ((*orgtbl-lstart* (or (plist-get params :hlstart) *orgtbl-lstart*)) (*orgtbl-llstart* (or (plist-get params :hllstart) *orgtbl-llstart*)) (*orgtbl-lend* (or (plist-get params :hlend) *orgtbl-lend*)) (*orgtbl-llend* (or (plist-get params :hllend) (plist-get params :hlend) *orgtbl-llend*)) (*orgtbl-lfmt* (or (plist-get params :hlfmt) *orgtbl-lfmt*)) (*orgtbl-llfmt* (or (plist-get params :hllfmt) (plist-get params :hlfmt) *orgtbl-llfmt*)) (*orgtbl-sep* (or (plist-get params :hlsep) *orgtbl-sep*)) (*orgtbl-fmt* (or (plist-get params :hfmt) *orgtbl-fmt*))) (orgtbl-format-section (quote hline))) (if (and hline (not skipheadrule)) (setq *orgtbl-rtn* (cons hline *orgtbl-rtn*))) (car-safe (prog1 *orgtbl-table* (setq *orgtbl-table* (cdr *orgtbl-table*)))))) (orgtbl-format-section nil) (if splicep nil (if (plist-member params :tend) (progn (let ((tend (orgtbl-eval-str ...))) (if tend (setq *orgtbl-rtn* (cons tend *orgtbl-rtn*))))))) (mapconcat (if remove-newlines (function (lambda (tend) (replace-regexp-in-string "[\n\r \f]" "\\\\n" tend))) (quote identity)) (nreverse (if remove-nil-linesp (remq nil *orgtbl-rtn*) *orgtbl-rtn*)) "\n"))
orgtbl-to-generic((3 2 4 4 2 1 0 2) (:sep " " :fmt org-babel-gnuplot-quote-tsv-field (:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "results") (:results . "file replace") (:var data 3 2 4 4 2 1 0 2) (:hlines . "no") (:session) (:file . "histogram.pdf") (:result-type . value) (:result-params "file" "replace") (:rowname-names) (:colname-names)))
(insert (orgtbl-to-generic table (org-combine-plists (quote (:sep " " :fmt org-babel-gnuplot-quote-tsv-field)) params)))
(save-current-buffer (set-buffer temp-buffer) (make-local-variable (quote org-babel-gnuplot-timestamp-fmt)) (setq org-babel-gnuplot-timestamp-fmt (or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S")) (insert (orgtbl-to-generic table (org-combine-plists (quote (:sep " " :fmt org-babel-gnuplot-quote-tsv-field)) params))))
(prog1 (save-current-buffer (set-buffer temp-buffer) (make-local-variable (quote org-babel-gnuplot-timestamp-fmt)) (setq org-babel-gnuplot-timestamp-fmt (or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S")) (insert (orgtbl-to-generic table (org-combine-plists (quote (:sep " " :fmt org-babel-gnuplot-quote-tsv-field)) params)))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0)))
(unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (make-local-variable (quote org-babel-gnuplot-timestamp-fmt)) (setq org-babel-gnuplot-timestamp-fmt (or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S")) (insert (orgtbl-to-generic table (org-combine-plists (quote (:sep " " :fmt org-babel-gnuplot-quote-tsv-field)) params)))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
(let ((temp-file data-file) (temp-buffer (get-buffer-create (generate-new-buffer-name " *temp file*")))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (make-local-variable (quote org-babel-gnuplot-timestamp-fmt)) (setq org-babel-gnuplot-timestamp-fmt (or (plist-get params :timefmt) "%Y-%m-%d-%H:%M:%S")) (insert (orgtbl-to-generic table (org-combine-plists (quote ...) params)))) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
org-babel-gnuplot-table-to-data((3 2 4 4 2 1 0 2) "/tmp/babel-31898wPP/gnuplot-31898Kkb" ((:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "results") (:results . "file replace") (:var data 3 2 4 4 2 1 0 2) (:hlines . "no") (:session) (:file . "histogram.pdf") (:result-type . value) (:result-params "file" "replace") (:rowname-names) (:colname-names)))
(if (listp (cdr pair)) (org-babel-gnuplot-table-to-data (cdr pair) (org-babel-temp-file "gnuplot-") params) (cdr pair))
(cons (car pair) (if (listp (cdr pair)) (org-babel-gnuplot-table-to-data (cdr pair) (org-babel-temp-file "gnuplot-") params) (cdr pair)))
(lambda (pair) (cons (car pair) (if (listp (cdr pair)) (org-babel-gnuplot-table-to-data (cdr pair) (org-babel-temp-file "gnuplot-") params) (cdr pair))))((data 3 2 4 4 2 1 0 2))
mapcar((lambda (pair) (cons (car pair) (if (listp (cdr pair)) (org-babel-gnuplot-table-to-data (cdr pair) (org-babel-temp-file "gnuplot-") params) (cdr pair)))) ((data 3 2 4 4 2 1 0 2)))
(let ((*org-babel-gnuplot-missing* (cdr (assoc :missing params)))) (mapcar (function (lambda (pair) (cons (car pair) (if (listp (cdr pair)) (org-babel-gnuplot-table-to-data (cdr pair) (org-babel-temp-file "gnuplot-") params) (cdr pair))))) (mapcar (function cdr) (org-babel-get-header params :var))))
org-babel-gnuplot-process-vars(((:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "results") (:results . "file replace") (:var data 3 2 4 4 2 1 0 2) (:hlines . "no") (:session) (:file . "histogram.pdf") (:result-type . value) (:result-params "file" "replace") (:rowname-names) (:colname-names)))
(let* ((vars (org-babel-gnuplot-process-vars params)) (out-file (cdr (assoc :file params))) (prologue (cdr (assoc :prologue params))) (epilogue (cdr (assoc :epilogue params))) (term (or (cdr (assoc :term params)) (if out-file (progn (let (...) (or ... ext)))))) (cmdline (cdr (assoc :cmdline params))) (title (cdr (assoc :title params))) (lines (cdr (assoc :line params))) (sets (cdr (assoc :set params))) (x-labels (cdr (assoc :xlabels params))) (y-labels (cdr (assoc :ylabels params))) (timefmt (cdr (assoc :timefmt params))) (time-ind (or (cdr (assoc :timeind params)) (if timefmt (progn 1)))) (add-to-body (function (lambda (text) (setq body (concat text "\n" body))))) output) (if title (progn (funcall add-to-body (format "set title '%s'" title)))) (if lines (progn (mapc (function (lambda (el) (funcall add-to-body el))) lines))) (if sets (progn (mapc (function (lambda (el) (funcall add-to-body (format "set %s" el)))) sets))) (if x-labels (progn (funcall add-to-body (format "set xtics (%s)" (mapconcat (function (lambda ... ...)) x-labels ", "))))) (if y-labels (progn (funcall add-to-body (format "set ytics (%s)" (mapconcat (function (lambda ... ...)) y-labels ", "))))) (if time-ind (progn (funcall add-to-body "set xdata time") (funcall add-to-body (concat "set timefmt \"" (or timefmt "%Y-%m-%d-%H:%M:%S") "\"")))) (if out-file (progn (funcall add-to-body (format "set output \"%s\"" out-file)) (setq body (concat body "\nset output\n")))) (if term (progn (funcall add-to-body (format "set term %s" term)))) (funcall add-to-body (mapconcat (function identity) (org-babel-variable-assignments:gnuplot params) "\n")) (mapc (function (lambda (pair) (setq body (replace-regexp-in-string (format "\\$%s" (car pair)) (cdr pair) body)))) vars) (if prologue (progn (funcall add-to-body prologue))) (if epilogue (progn (setq body (concat body "\n" epilogue)))))
(progn (let* ((vars (org-babel-gnuplot-process-vars params)) (out-file (cdr (assoc :file params))) (prologue (cdr (assoc :prologue params))) (epilogue (cdr (assoc :epilogue params))) (term (or (cdr (assoc :term params)) (if out-file (progn (let ... ...))))) (cmdline (cdr (assoc :cmdline params))) (title (cdr (assoc :title params))) (lines (cdr (assoc :line params))) (sets (cdr (assoc :set params))) (x-labels (cdr (assoc :xlabels params))) (y-labels (cdr (assoc :ylabels params))) (timefmt (cdr (assoc :timefmt params))) (time-ind (or (cdr (assoc :timeind params)) (if timefmt (progn 1)))) (add-to-body (function (lambda (text) (setq body (concat text "\n" body))))) output) (if title (progn (funcall add-to-body (format "set title '%s'" title)))) (if lines (progn (mapc (function (lambda (el) (funcall add-to-body el))) lines))) (if sets (progn (mapc (function (lambda (el) (funcall add-to-body ...))) sets))) (if x-labels (progn (funcall add-to-body (format "set xtics (%s)" (mapconcat (function ...) x-labels ", "))))) (if y-labels (progn (funcall add-to-body (format "set ytics (%s)" (mapconcat (function ...) y-labels ", "))))) (if time-ind (progn (funcall add-to-body "set xdata time") (funcall add-to-body (concat "set timefmt \"" (or timefmt "%Y-%m-%d-%H:%M:%S") "\"")))) (if out-file (progn (funcall add-to-body (format "set output \"%s\"" out-file)) (setq body (concat body "\nset output\n")))) (if term (progn (funcall add-to-body (format "set term %s" term)))) (funcall add-to-body (mapconcat (function identity) (org-babel-variable-assignments:gnuplot params) "\n")) (mapc (function (lambda (pair) (setq body (replace-regexp-in-string (format "\\$%s" ...) (cdr pair) body)))) vars) (if prologue (progn (funcall add-to-body prologue))) (if epilogue (progn (setq body (concat body "\n" epilogue))))) body)
(unwind-protect (progn (let* ((vars (org-babel-gnuplot-process-vars params)) (out-file (cdr (assoc :file params))) (prologue (cdr (assoc :prologue params))) (epilogue (cdr (assoc :epilogue params))) (term (or (cdr (assoc :term params)) (if out-file (progn ...)))) (cmdline (cdr (assoc :cmdline params))) (title (cdr (assoc :title params))) (lines (cdr (assoc :line params))) (sets (cdr (assoc :set params))) (x-labels (cdr (assoc :xlabels params))) (y-labels (cdr (assoc :ylabels params))) (timefmt (cdr (assoc :timefmt params))) (time-ind (or (cdr (assoc :timeind params)) (if timefmt (progn 1)))) (add-to-body (function (lambda (text) (setq body ...)))) output) (if title (progn (funcall add-to-body (format "set title '%s'" title)))) (if lines (progn (mapc (function (lambda ... ...)) lines))) (if sets (progn (mapc (function (lambda ... ...)) sets))) (if x-labels (progn (funcall add-to-body (format "set xtics (%s)" (mapconcat ... x-labels ", "))))) (if y-labels (progn (funcall add-to-body (format "set ytics (%s)" (mapconcat ... y-labels ", "))))) (if time-ind (progn (funcall add-to-body "set xdata time") (funcall add-to-body (concat "set timefmt \"" (or timefmt "%Y-%m-%d-%H:%M:%S") "\"")))) (if out-file (progn (funcall add-to-body (format "set output \"%s\"" out-file)) (setq body (concat body "\nset output\n")))) (if term (progn (funcall add-to-body (format "set term %s" term)))) (funcall add-to-body (mapconcat (function identity) (org-babel-variable-assignments:gnuplot params) "\n")) (mapc (function (lambda (pair) (setq body (replace-regexp-in-string ... ... body)))) vars) (if prologue (progn (funcall add-to-body prologue))) (if epilogue (progn (setq body (concat body "\n" epilogue))))) body) (set-window-configuration wconfig))
(let ((wconfig (current-window-configuration))) (unwind-protect (progn (let* ((vars (org-babel-gnuplot-process-vars params)) (out-file (cdr (assoc :file params))) (prologue (cdr (assoc :prologue params))) (epilogue (cdr (assoc :epilogue params))) (term (or (cdr ...) (if out-file ...))) (cmdline (cdr (assoc :cmdline params))) (title (cdr (assoc :title params))) (lines (cdr (assoc :line params))) (sets (cdr (assoc :set params))) (x-labels (cdr (assoc :xlabels params))) (y-labels (cdr (assoc :ylabels params))) (timefmt (cdr (assoc :timefmt params))) (time-ind (or (cdr ...) (if timefmt ...))) (add-to-body (function (lambda ... ...))) output) (if title (progn (funcall add-to-body (format "set title '%s'" title)))) (if lines (progn (mapc (function ...) lines))) (if sets (progn (mapc (function ...) sets))) (if x-labels (progn (funcall add-to-body (format "set xtics (%s)" ...)))) (if y-labels (progn (funcall add-to-body (format "set ytics (%s)" ...)))) (if time-ind (progn (funcall add-to-body "set xdata time") (funcall add-to-body (concat "set timefmt \"" ... "\"")))) (if out-file (progn (funcall add-to-body (format "set output \"%s\"" out-file)) (setq body (concat body "\nset output\n")))) (if term (progn (funcall add-to-body (format "set term %s" term)))) (funcall add-to-body (mapconcat (function identity) (org-babel-variable-assignments:gnuplot params) "\n")) (mapc (function (lambda (pair) (setq body ...))) vars) (if prologue (progn (funcall add-to-body prologue))) (if epilogue (progn (setq body (concat body "\n" epilogue))))) body) (set-window-configuration wconfig)))
org-babel-expand-body:gnuplot("set xrange [-0.5:25.5]\nset yrange [0:4.2]\nplot data with histograms notitle" ((:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "results") (:results . "file replace") (:var data 3 2 4 4 2 1 0 2) (:hlines . "no") (:session) (:file . "histogram.pdf") (:result-type . value) (:result-params "file" "replace") (:rowname-names) (:colname-names)))
(let ((session (cdr (assoc :session params))) (result-type (cdr (assoc :results params))) (out-file (cdr (assoc :file params))) (body (org-babel-expand-body:gnuplot body params)) output) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (if (string= session "none") (let ((script-file ...)) (let (... ...) (unwind-protect ... ...)) (message "gnuplot \"%s\"" script-file) (setq output (shell-command-to-string ...)) (message output)) (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...)))) (if (member "output" (split-string result-type)) output nil)) (set-window-configuration wconfig))))
org-babel-execute:gnuplot("set xrange [-0.5:25.5]\nset yrange [0:4.2]\nplot data with histograms notitle" ((:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "results") (:results . "file replace") (:var data 3 2 4 4 2 1 0 2) (:hlines . "no") (:session) (:file . "histogram.pdf") (:result-type . value) (:result-params "file" "replace") (:rowname-names) (:colname-names)))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [bug] cannot extract just one column of table for use in gnuplot src block
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
2014-03-24 8:22 ` Eric S Fraga
0 siblings, 1 reply; 6+ messages in thread
From: Achim Gratz @ 2014-03-23 17:51 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [bug] cannot extract just one column of table for use in gnuplot src block
2014-03-23 17:51 ` Achim Gratz
@ 2014-03-24 8:22 ` Eric S Fraga
2014-03-24 13:57 ` Bastien
0 siblings, 1 reply; 6+ messages in thread
From: Eric S Fraga @ 2014-03-24 8:22 UTC (permalink / raw)
To: Achim Gratz; +Cc: emacs-orgmode
Achim Gratz <Stromeko@nexgo.de> writes:
> 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.
Yes, true; what I meant was that the data extracted were the data I
expected to be extracted. The structure may be wrong.
>> 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:
This patch seems to work. Thanks!
--
: Eric S Fraga (0xFFFCF67D), Emacs 24.4.50.2, Org release_8.2.5h-831-gcb9172.dirty
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-03-25 21:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).