emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Bug] #+call does not respect :colnames argument
@ 2013-07-26 15:12 Rick Frankel
  2013-07-26 17:53 ` Eric Schulte
  0 siblings, 1 reply; 9+ messages in thread
From: Rick Frankel @ 2013-07-26 15:12 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

Eric-

I have debugged why the :colnames argument is not respected as to
removing the header from a table var.

* Given
#+name: with-hline
| A | B | C |
|---+---+---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |

#+name: with-hline2
| B | C | D |
|---+---+---|
| 2 | 3 | 4 |
| 5 | 6 | 7 |

#+name: emacs-echo
#+BEGIN_SRC emacs-lisp :var table=with-hline :colnames yes
(mapcar (lambda (x) (mapcar '1+ x)) table)
#+END_SRC

#+call: emacs-echo(table=with-hline2)[:colnames yes]

* Evaluation
When the `#+call' line is executed, `org-babel-process-params' is
called multiple times. When it is called the last time to process
the actual input (here, calling =emacs-echo= with the param
=with-hline2=), the `:colname-names' parameter has already been (to
=(table "A" "B" "C")=, taken from the variable in the source blocks
header) as a side-effect of the call to
`org-babel-get-src-block-info'. So, when the block is executed later
in the function, then next call to `org-babel-process-params' does
not call disassemble table (taking into account the value of
`:colnames') but uses =processed-vars= directly instead, causing the 
full
table to be used without calling `org-babel-disassemble-tables'.

Here's the relevant section of code from `org-babel-process-params':

#+BEGIN_SRC emacs-lisp
(if (and (assoc :colname-names params)
(assoc :rowname-names params))
(list processed-vars)
(org-babel-disassemble-tables
processed-vars
(cdr (assoc :hlines params))
(cdr (assoc :colnames params))
(cdr (assoc :rownames params))))
#+END_SRC

And here's a cleaned-up debug trace:

#+BEGIN_EXAMPLE
(list processed-vars)
;; called again later in execute-src-block, does not properly parse 
=with-hline2= var
org-babel-process-params(((:comments . "") (:shebang . "") (:cache . 
"no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . 
"results") (:results . "silent") (:var . "table=with-hline2") (:hlines . 
"yes") (:padnewline . "yes") (:session . "none") (:colnames . "yes") 
(:result-type . value) (:result-params "replace") (:rowname-names) 
(:colname-names (table "A" "B" "C"))))
;; calls disassemble-tables and returns with :colname-names set
org-babel-process-params(((:comments . "") (:shebang . "") (:cache . 
"no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . 
"results") (:results . "replace") (:var . "table=with-hline") (:colnames 
. "yes") (:session . "none") (:padnewline . "yes") (:hlines . "yes")))
org-babel-get-src-block-info()
org-babel-execute-src-block(nil nil ((:var . "table=with-hline2") 
(:results . "silent")))
org-babel-ref-resolve("emacs-echo(table=with-hline2)[:colnames yes]")
org-babel-ref-parse("results=emacs-echo(table=with-hline2)[:colnames 
yes]")
org-babel-process-params(((:comments . "") (:shebang . "") (:cache . 
"no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . 
"results") (:results . "replace") (:var . 
"results=emacs-echo(table=with-hline2)[:colnames yes]") (:colnames . 
"no") (:hlines . "yes") (:padnewline . "yes") (:session . "none")))
org-babel-lob-execute(("emacs-echo(table=with-hline2)[:colnames yes]" 
nil 0 nil))
#+END_EXAMPLE

rick

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-07-29 17:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-26 15:12 [Bug] #+call does not respect :colnames argument Rick Frankel
2013-07-26 17:53 ` Eric Schulte
2013-07-26 20:52   ` Rick Frankel
2013-07-27  0:54     ` Eric Schulte
2013-07-29  1:10       ` Rick Frankel
2013-07-29  4:18       ` Achim Gratz
2013-07-29 14:00         ` Eric Schulte
2013-07-29 17:01           ` Achim Gratz
2013-07-29 17:20             ` Eric Schulte

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).