Christian Moe <[email protected]> writes:

> Christian Moe <[email protected]> writes:

>> We have similar dilemma for src blocks. That dillema is solved by
>> src_name() vs src_name[] syntax.
>
> Isn't that different? The () syntax gets the results of evaluation and
> the [] syntax gets the code, but the RESULTS below the referenced src
> block don't get updated in either case; the buffer changes are only to
> the results of the block that does the referencing.

Right.
Maybe block_name(:eval yes), block_name(:eval no),
block_name(:eval auto) == block_name

>> As for multiple elements in a block, I'd argue that reading the first
>> element should do, because:
>>
>> 1. Reading one element suffices for clocktable, columnview, and
>>    block-update-time.
>
> Sorry, correcting myself. I just realized I ignored the `:step' option
> for clocktable, which breaks the table into chunks. It's not obvious how
> that should be handled, or indeed if it should, since it's not clear
> what anyone would want to read that with Babel for. But if we have to
> consider it, obviously just reading the first element won't do.
>
> It also complicates the alternative approach of writing NAME keywords in
> the clocktable. I suppose `:name my-clocktable :step week' could
> generate automatically named tables labeled
>
>   Weekly report starting on: [2026-03-11 Wed]
>   #+NAME: my-clocktable-weekly-2026-03-11
>   | ... | 
>
> and so on. But that is hardly useful for Babel purposes unless you know
> exactly what week you're interested in.
>
> I can only think of two ways to handle that:
>
> - Read the full text of the dblock and let the user deal with it
>
> - Read all readable elements in the dblock into a list, as discussed in
>   the previous message.

As another data point, :var x=heading-id will return all the text past
metadata (`org-babel-ref-headline-body').

What we can do, is allowing
block_name[] -> full contents
block_name[0] -> first element
block_name[0:2] -> first two elements
for first two rows of table inside block -> block_name[0,-2:-1]
I think `org-babel-ref-index-list' should be able to handle arbitrary
nesting.

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