On 2013-07-03 13:23, Eric Schulte wrote:
Currently colnames are not used for emacs-lisp code blocks (for
historical reasons). Unfortunately, call lines are executed by
expanding first to a trivial emacs-lisp code block, which is then run
to
collect and possibly re-package the results of the called function.
Thus colnames do not work well in call lines.
I think the best solution here is to add colnames support to Emacs Lisp
code blocks. I can put this on my Org-mode queue, but can't promise to
get to it any time soon.
I'm confused by this response, as the behavior exhibited by org-mode
seems to indicate that :colnames IS affecting emacs-lisp code blocks,
but inconsistenly affecting "called" code blocks -- only applying to the
output but not the input as exhibited in an example in a previous
email. As to the above, given:
#+name: table1
| 1 | 2 | 3 |
|---+---+---|
| 4 | 5 | 6 |
and the code:
#+name: map1
#+BEGIN_SRC emacs-lisp :var table=table1 :colnames yes
(mapcar (lambda (row) (mapcar '1+ row)) table)
#+END_SRC
I get:
#+RESULTS: map1
| 1 | 2 | 3 |
|---+---+---|
| 5 | 6 | 7 |
and the `*Message*' buffer contains:
#+BEGIN_EXAMPLE
executing Emacs-Lisp code block (map1)...
(table (quote ((4 5 6))))
Code block evaluation complete.
#+END_EXAMPLE
But, removing the :colnames argument:
#+name: map2
#+BEGIN_SRC emacs-lisp :var table=table1
(mapcar (lambda (row) (mapcar '1+ row)) table)
#+END_SRC
give the error "Wrong type argument: sequencep, hline", and the
message buffer shows:
#+BEGIN_EXAMPLE
executing Emacs-Lisp code block (map2)...
(table (quote ((1 2 3) hline (4 5 6))))
Wrong type argument: sequencep, hline
#+END_EXAMPLE
Finally,
#+name: mapp:
#+BEGIN_SRC emacs-lisp :var table=table1
(mapcar (lambda (row) (if (listp row) (mapcar '1+ row) row)) table)
#+END_SRC
#+RESULTS: mapp:
| 2 | 3 | 4 |
|---+---+---|
| 5 | 6 | 7 |
and the message buffer contains:
#+BEGIN_EXAMPLE
executing Emacs-Lisp code block (mapp:)...
(table (quote ((1 2 3) hline (4 5 6))))
Code block evaluation complete.
#+END_EXAMPLE
#+name: call1
#+call: map1()
works:
#+RESULTS: call1
| 1 | 2 | 3 |
|---+---+---|
| 5 | 6 | 7 |
with the message:
#+BEGIN_EXAMPLE
executing Emacs-Lisp code block (map1)...
(table (quote ((4 5 6))))
((1 2 3) hline (5 6 7))
executing Emacs-Lisp code block (call1)...
(results (quote ((1 2 3) hline (5 6 7))))
Code block evaluation complete.
#+END_EXAMPLE
but:
#+name: call2
#+call: map1(table=table1)
Generates the following message:
#+BEGIN_EXAMPLE
executing Emacs-Lisp code block (map1)...
(table (quote ((4 5 6))))
((1 2 3) hline (5 6 7))
executing Emacs-Lisp code block (call1)...
(results (quote ((1 2 3) hline (5 6 7))))
Code block evaluation complete.
Mark set [2 times]
#+END_EXAMPLE
rick