all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-babel :colnames yes
@ 2020-05-28 11:48 ian martins
  2020-05-28 13:29 ` Nick Dokos
  2020-05-28 13:44 ` ian martins
  0 siblings, 2 replies; 4+ messages in thread
From: ian martins @ 2020-05-28 11:48 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 753 bytes --]

Hello, I'm trying to figure out how to tell org that the first row of a src
block result is a table header.

from readthedocs
<https://org-babel.readthedocs.io/en/latest/header-args/#colnames> it looks
like ":colnames yes" should do this, but I haven't been able to get it to
work, and the code
<https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-core.el#L1671>
doesn't appear to want that to happen. maybe that is special handling for R
<https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-R.el#L164>.

#+BEGIN_SRC elisp :colnames yes
  '((one two) (1 3) (1 6))
#+END_SRC

I'm expecting an hline in the output but do not find one.

I know ":colnames '(one two)" works, but I don't know the header value
until I've generated the table.

-Ian

[-- Attachment #2: Type: text/html, Size: 1006 bytes --]

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

* Re: org-babel :colnames yes
  2020-05-28 11:48 org-babel :colnames yes ian martins
@ 2020-05-28 13:29 ` Nick Dokos
  2020-05-28 13:44 ` ian martins
  1 sibling, 0 replies; 4+ messages in thread
From: Nick Dokos @ 2020-05-28 13:29 UTC (permalink / raw)
  To: emacs-orgmode

Would this work for you?

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC elisp :colnames yes
 '((one two) hline (1 3) (1 6))
#+END_SRC

#+RESULTS:
| one | two |
|-----+-----|
|   1 |   3 |
|   1 |   6 |

--8<---------------cut here---------------end--------------->8---

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler



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

* Re: org-babel :colnames yes
  2020-05-28 11:48 org-babel :colnames yes ian martins
  2020-05-28 13:29 ` Nick Dokos
@ 2020-05-28 13:44 ` ian martins
  2020-05-29  2:08   ` ian martins
  1 sibling, 1 reply; 4+ messages in thread
From: ian martins @ 2020-05-28 13:44 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]

I figured out that inserting `hline' works for some languages.  consistent
behavior with ":colnames yes" would be ideal but this solves my problem.

#+BEGIN_SRC elisp
  '((one two) hline (1 3) (1 6))
#+END_SRC

On Thu, May 28, 2020 at 7:48 AM ian martins <ianxm@jhu.edu> wrote:

> Hello, I'm trying to figure out how to tell org that the first row of a
> src block result is a table header.
>
> from readthedocs
> <https://org-babel.readthedocs.io/en/latest/header-args/#colnames> it
> looks like ":colnames yes" should do this, but I haven't been able to get
> it to work, and the code
> <https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-core.el#L1671>
> doesn't appear to want that to happen. maybe that is special handling for
> R <https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-R.el#L164>.
>
> #+BEGIN_SRC elisp :colnames yes
>   '((one two) (1 3) (1 6))
> #+END_SRC
>
> I'm expecting an hline in the output but do not find one.
>
> I know ":colnames '(one two)" works, but I don't know the header value
> until I've generated the table.
>
> -Ian
>

[-- Attachment #2: Type: text/html, Size: 1667 bytes --]

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

* Re: org-babel :colnames yes
  2020-05-28 13:44 ` ian martins
@ 2020-05-29  2:08   ` ian martins
  0 siblings, 0 replies; 4+ messages in thread
From: ian martins @ 2020-05-29  2:08 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 157 bytes --]

Nick Dokos wrote:

> Would this work for you?
>
> #+BEGIN_SRC elisp :colnames yes
>   '((one two) hline (1 3) (1 6))
> #+END_SRC
>

Yes, that works. Thanks.

[-- Attachment #2: Type: text/html, Size: 403 bytes --]

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

end of thread, other threads:[~2020-05-29  2:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-28 11:48 org-babel :colnames yes ian martins
2020-05-28 13:29 ` Nick Dokos
2020-05-28 13:44 ` ian martins
2020-05-29  2:08   ` ian martins

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.