emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] #+call-line removes hlines and headings ?
@ 2012-01-29  8:08 Marc-Oliver Ihm
  2012-01-29 10:42 ` Andreas Leha
  0 siblings, 1 reply; 5+ messages in thread
From: Marc-Oliver Ihm @ 2012-01-29  8:08 UTC (permalink / raw)
  To: emacs-orgmode

Hello !

Generally enjoying babel very much, I have stumbled across a behaviour, that I do not quite understand:
As it seems, a #+call in babel removes hlines from the results.

Here is an example:

#+call: foo()
| 3 | 4 |

#+name: foo
#+begin_src emacs-lisp
'((1 2) hline (3 4))
#+end_src

#+results: foo
| 1 | 2 |
|---+---|
| 3 | 4 |


The #+begin_src-line does what I would expect; however, when it is called through a #+call-line the hline
and the heading are removed.

Is this the intended behaviour, a bug or am I missing something obvious ?

Thanx a lot for any help !

with kind regards, Marc-Oliver Ihm

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

* Re: [babel] #+call-line removes hlines and headings ?
  2012-01-29  8:08 [babel] #+call-line removes hlines and headings ? Marc-Oliver Ihm
@ 2012-01-29 10:42 ` Andreas Leha
  2012-01-29 14:21   ` Marc-Oliver Ihm
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Leha @ 2012-01-29 10:42 UTC (permalink / raw)
  To: emacs-orgmode

Marc-Oliver Ihm <marc-oliver.ihm@online.de> writes:

> Hello !
>
> Generally enjoying babel very much, I have stumbled across a behaviour, that I do not quite understand:
> As it seems, a #+call in babel removes hlines from the results.
>
> Here is an example:
>
> #+call: foo()
> | 3 | 4 |
> #+name: foo
> #+begin_src emacs-lisp
> '((1 2) hline (3 4))
> #+end_src
>
> #+results: foo
> | 1 | 2 |
> |---+---|
> | 3 | 4 |
>
>
> The #+begin_src-line does what I would expect; however, when it is called through a #+call-line the hline
> and the heading are removed.
>
> Is this the intended behaviour, a bug or am I missing something obvious ?
>
> Thanx a lot for any help !
>
> with kind regards, Marc-Oliver Ihm

Hi Marc-Oliver,

it works with

#+call: foo() :colnames yes

The more surprising part for me is, that it works on the block itself
without.

Best,
Andreas

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

* Re: [babel] #+call-line removes hlines and headings ?
  2012-01-29 10:42 ` Andreas Leha
@ 2012-01-29 14:21   ` Marc-Oliver Ihm
  2012-01-30 16:10     ` Eric Schulte
  0 siblings, 1 reply; 5+ messages in thread
From: Marc-Oliver Ihm @ 2012-01-29 14:21 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

Am 29.01.2012 11:42, schrieb Andreas Leha:
> :colnames yes
Hi Andreas,

Thanx, that is definitely a solution !

And I agree with you, that its a bit puzzling, that both cases behave differently;
the #+call-line should just have the same result as the #+begin_src-line, to which after all
it just refers. Beeing able to change the behaviour of the #+call-line with header arguments is
of course a good thing, but it should not be necessary here in the first place.

However, this would require a patch to the babel-code, which I am currently not able to produce, because I already
got lost in debugging this problem :-) And of course I am not sure what would be the side effects of changing this
behaviour ...

So, thanx again for pointing out this very easy workaround !


with kind regards, Marc-Oliver Ihm

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

* Re: [babel] #+call-line removes hlines and headings ?
  2012-01-29 14:21   ` Marc-Oliver Ihm
@ 2012-01-30 16:10     ` Eric Schulte
  2012-01-31 18:45       ` Marc-Oliver Ihm
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Schulte @ 2012-01-30 16:10 UTC (permalink / raw)
  To: Marc-Oliver Ihm; +Cc: Andreas Leha, emacs-orgmode

Marc-Oliver Ihm <marc-oliver.ihm@online.de> writes:

> Am 29.01.2012 11:42, schrieb Andreas Leha:
>> :colnames yes
> Hi Andreas,
>
> Thanx, that is definitely a solution !
>
> And I agree with you, that its a bit puzzling, that both cases behave differently;
> the #+call-line should just have the same result as the #+begin_src-line, to which after all
> it just refers. Beeing able to change the behaviour of the #+call-line
> with header arguments is
> of course a good thing, but it should not be necessary here in the first place.
>
> However, this would require a patch to the babel-code, which I am
> currently not able to produce, because I already
> got lost in debugging this problem :-) And of course I am not sure
> what would be the side effects of changing this
> behaviour ...
>
> So, thanx again for pointing out this very easy workaround !
>
>
> with kind regards, Marc-Oliver Ihm
>

To explain the cause (if not rationale) for the current behavior; when
executing a call line, an ephemeral code block is created at the point
of the call line.  The result of the called function is passed into this
ephemeral block, and the output of the block is inserted into the
buffer.

This is why call lines have *two* possible sets of header arguments, one
to pass to the original called code block, and one for local effect in
the ephemeral block.

The reason the colnames header argument is required for the call line
and not the code block, is because hlines are only stripped when data
passes *into* a code block as a variable.  In this case the 'hlines are
stripped when the table passes into the ephemeral code blocks.

Hope the above is more illuminating that confusing,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

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

* Re: [babel] #+call-line removes hlines and headings ?
  2012-01-30 16:10     ` Eric Schulte
@ 2012-01-31 18:45       ` Marc-Oliver Ihm
  0 siblings, 0 replies; 5+ messages in thread
From: Marc-Oliver Ihm @ 2012-01-31 18:45 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Andreas Leha, emacs-orgmode

Hi Eric,

thanx ! That explains very clearly what I have seen, when trying to debug this phaenomenon.
So this behaviour is by design and I can work around :-)

kind regards, Marc



Am 30.01.2012 17:10, schrieb Eric Schulte:
> Marc-Oliver Ihm<marc-oliver.ihm@online.de>  writes:
>
>> Am 29.01.2012 11:42, schrieb Andreas Leha:
>>> :colnames yes
>> Hi Andreas,
>>
>> Thanx, that is definitely a solution !
>>
>> And I agree with you, that its a bit puzzling, that both cases behave differently;
>> the #+call-line should just have the same result as the #+begin_src-line, to which after all
>> it just refers. Beeing able to change the behaviour of the #+call-line
>> with header arguments is
>> of course a good thing, but it should not be necessary here in the first place.
>>
>> However, this would require a patch to the babel-code, which I am
>> currently not able to produce, because I already
>> got lost in debugging this problem :-) And of course I am not sure
>> what would be the side effects of changing this
>> behaviour ...
>>
>> So, thanx again for pointing out this very easy workaround !
>>
>>
>> with kind regards, Marc-Oliver Ihm
>>
>
> To explain the cause (if not rationale) for the current behavior; when
> executing a call line, an ephemeral code block is created at the point
> of the call line.  The result of the called function is passed into this
> ephemeral block, and the output of the block is inserted into the
> buffer.
>
> This is why call lines have *two* possible sets of header arguments, one
> to pass to the original called code block, and one for local effect in
> the ephemeral block.
>
> The reason the colnames header argument is required for the call line
> and not the code block, is because hlines are only stripped when data
> passes *into* a code block as a variable.  In this case the 'hlines are
> stripped when the table passes into the ephemeral code blocks.
>
> Hope the above is more illuminating that confusing,
>

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

end of thread, other threads:[~2012-01-31 18:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-29  8:08 [babel] #+call-line removes hlines and headings ? Marc-Oliver Ihm
2012-01-29 10:42 ` Andreas Leha
2012-01-29 14:21   ` Marc-Oliver Ihm
2012-01-30 16:10     ` Eric Schulte
2012-01-31 18:45       ` Marc-Oliver Ihm

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