Re: [BUG] With R using ":var d=data" breaks ":colnames yes" [9.7-pre (release_9.6.10-881-g595a32]

2024-03-07 Thread Ihor Radchenko
Paul Stansell  writes:

> Thanks for your advice, it helps a lot.  Sorry for submitting
> something that wasn't a bug.

While not a bug, the situation can certainly be improved.
Things should be a bit smarter on main after
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=cab81f242

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] With R using ":var d=data" breaks ":colnames yes" [9.7-pre (release_9.6.10-881-g595a32]

2024-03-07 Thread Paul Stansell
Hi Ihor,

Thanks for your advice, it helps a lot.  Sorry for submitting
something that wasn't a bug.

Paul

On Thu, 7 Mar 2024 at 13:16, Ihor Radchenko  wrote:

> Paul Stansell  writes:
>
> > It seems that using ":var d=data" breaks ":colnames yes" in the header of
> > an R code block.
> > ...
> > #+name: data
> > |+|
> > |  x |  y |
> > |+|
> > | 111.89 |  88.37 |
> > | 392.12 | 297.33 |
> > |+|
>
> It is expected.
> :colnames yes implies:
>
>  The ‘colnames’ header argument accepts ‘yes’, ‘no’, or ‘nil’
>  values.  The default value is ‘nil’: if an input table has column
>  names--because the second row is a horizontal rule--then Org
>  removes the column names, processes the table, puts back the column
>  names, and then writes the table to the results block.  Using
>  ‘yes’, Org does the same to the first row, even if the initial
>  ^
>  table does not contain any horizontal rule.  When set to ‘no’, Org
>  does not pre-process column names at all.
>
> In your table, the first row is a horizontal line, so Org tries to parse
> the first line as column names. And fails, of course.
>
> I guess that we can make `org-babel-get-colnames' smarter and make it
> skip the leading hlines.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: [BUG] With R using ":var d=data" breaks ":colnames yes" [9.7-pre (release_9.6.10-881-g595a32]

2024-03-07 Thread Ihor Radchenko
Paul Stansell  writes:

> It seems that using ":var d=data" breaks ":colnames yes" in the header of
> an R code block.
> ...
> #+name: data
> |+|
> |  x |  y |
> |+|
> | 111.89 |  88.37 |
> | 392.12 | 297.33 |
> |+|

It is expected.
:colnames yes implies:

 The ‘colnames’ header argument accepts ‘yes’, ‘no’, or ‘nil’
 values.  The default value is ‘nil’: if an input table has column
 names--because the second row is a horizontal rule--then Org
 removes the column names, processes the table, puts back the column
 names, and then writes the table to the results block.  Using
 ‘yes’, Org does the same to the first row, even if the initial
 ^
 table does not contain any horizontal rule.  When set to ‘no’, Org
 does not pre-process column names at all.

In your table, the first row is a horizontal line, so Org tries to parse
the first line as column names. And fails, of course.

I guess that we can make `org-babel-get-colnames' smarter and make it
skip the leading hlines.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at