emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Babel: the disappearing hline


From: Eric Schulte
Subject: Re: [O] Babel: the disappearing hline
Date: Wed, 13 Nov 2013 07:17:04 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Jarmo Hurri <address@hidden> writes:

> Rick Frankel <address@hidden> writes:
>
> Greetings again.
>
>> Again, the solution is to globally set the :hline property to =yes=
>> instead of the default =no=, and you will get the results you want.
>
> The issue I am trying to raise here is the consistency of the system,
> not the way to solve this particular problem. Personally I think it
> would be clearer if the handling of hlines in _output_ were consistent
> _by default_, regardless of whether the call is made by direct
> evaluation of a block; by a post(); or by a #+CALL. I found it very
> weird when I bumped into this discrepancy - in a much more complicated
> context than the examples I have shown here.
>
> But it is your system and you know what kind of qualities you want it to
> have. I am just learning the ropes and sending you a message from the
> trenches.
>
> All the best,
>
> Jarmo
>

I understand that this particular use case is confusing, however there
are competing use cases and the case described here is not the most
common.

Take for example the following.

    #+name: data
    | header |
    |--------|
    | one    |
    | two    |
    |--------|
    | three  |

    #+BEGIN_SRC sh :var in=data
      echo "$in"
    #+END_SRC

    #+RESULTS:
    | header |
    | one    |
    | two    |
    | three  |

In fact, hlines are *not* preserved by default with regular code blocks.
And in practice only emacs-lisp code blocks tend to create hlines
themselves.  In general babel does a good deal of hline and colnames
processing.

    #+name: with-a-header
    | numbers |
    |---------|
    | one     |
    | two     |
    | three   |
    | four    |

    Strips both the header *and* the top hline by default.
    #+begin_src emacs-lisp :var in=with-a-header
      (mapcar (lambda (row) (mapcar #'length row)) in)
    #+end_src

    #+RESULTS:
    | 3 |
    | 3 |
    | 5 |
    | 4 |

    Applies the code block only to the body of the input table.
    #+begin_src emacs-lisp :var in=with-a-header :colnames yes
      (mapcar (lambda (row) (mapcar #'length row)) in)
    #+end_src

    #+RESULTS:
    | numbers |
    |---------|
    |       3 |
    |       3 |
    |       5 |
    |       4 |

Perhaps we should change `org-babel-default-inline-header-args' to
include `(:hlines "yes")'.  If there is no push back on that change I'd
be happy to make it.

Regards,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



reply via email to

[Prev in Thread] Current Thread [Next in Thread]