Jérémie Juste <[email protected]> writes:

> Many thanks for the report.  I haven't seen this feature in the
> documentation. Have i missed anything?
> I would suspect as least R users to favor the column name directly in R,but
> i don't see any issues implementing it if we are all going in this
> direction.  Note also that errors are silent for elisp.
> Should this be the expected behavior?

Because it is indeed undocumented.
However, it seems to be the original design as well.
We have the following everywhere (but not in ob-R):

(org-babel-reassemble-table
  (org-babel-result-cond (cdr (assq :result-params params))
     scalar-result
     table-result)
  (org-babel-pick-name
    (cdr (assq :colname-names params))
    (cdr (assq :colnames params)))
  (org-babel-pick-name
     (cdr (assq :rowname-names params))
     (cdr (assq :rownames params))))

The whole purpose of `org-babel-pick-name' is to support this
undocumented feature with :rownames/:colnames allowed to be a list.
Otherwise, the code could simply use
(cdr (assq :colname-names params))

> #+begin_src elisp :colnames '("Odd")
> '((1 2) (3 4) (5 6))
> #+end_src
>
> #+RESULTS:
> | 1 | 2 |
> | 3 | 4 |
> | 5 | 6 |

>From my reading of the code, the idea is setting column names in the
output - the number of column names should correspond to the number of
columns in the results.

#+begin_src emacs-lisp :colnames '("a" "b")
  '((1 2) (3 4) (5 6))
#+end_src

#+RESULTS:
| a | b |
|---+---|
| 1 | 2 |
| 3 | 4 |
| 5 | 6 |


-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to