emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Table cell refs with @0 or $0 are broken
@ 2012-04-04  9:35 James Harkins
  2012-04-04 17:17 ` Nick Dokos
  0 siblings, 1 reply; 11+ messages in thread
From: James Harkins @ 2012-04-04  9:35 UTC (permalink / raw)
  To: emacs-orgmode

Don't know if this is fixed in a later org update, but -- the online org manual says that you can refer to table cells in the current row or column using @0 and $0 respectively, but that's definitely not working on my machine.

** Works
| 1.0 |
| 2.0 |
|  3. |
#+TBLFM: @>$1=vsum(@1..@2)

** Broken: "Not in table data field"
| 1.0 |
| 2.0 |
|     |
#+TBLFM: @>$1=vsum(@1$0..@2$0)

It's not a critical issue because it does work to omit $0 -- so my immediate problem is solved (getting the sum to calculate). But it costs a little extra time because either a/ the manual is wrong or b/ $0 is supposed to work and there's a bug.

Thanks,
James


--
James Harkins /// dewdrop world
jamshark70@dewdrop-world.net
http://www.dewdrop-world.net

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

blog: http://www.dewdrop-world.net/words
audio clips: http://www.dewdrop-world.net/audio
more audio: http://soundcloud.com/dewdrop_world/tracks

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

* Re: Table cell refs with @0 or $0 are broken
  2012-04-04  9:35 Table cell refs with @0 or $0 are broken James Harkins
@ 2012-04-04 17:17 ` Nick Dokos
  2012-04-04 20:24   ` Christian Moe
  2012-04-05  0:35   ` James Harkins
  0 siblings, 2 replies; 11+ messages in thread
From: Nick Dokos @ 2012-04-04 17:17 UTC (permalink / raw)
  To: James Harkins; +Cc: nicholas.dokos, emacs-orgmode

James Harkins <jamshark70@gmail.com> wrote:

> Don't know if this is fixed in a later org update, but -- the online
> org manual says that you can refer to table cells in the current row
> or column using @0 and $0 respectively, but that's definitely not
> working on my machine.
> 
> ** Works
> | 1.0 |
> | 2.0 |
> |  3. |
> #+TBLFM: @>$1=vsum(@1..@2)
> 
> ** Broken: "Not in table data field"
> | 1.0 |
> | 2.0 |
> |     |
> #+TBLFM: @>$1=vsum(@1$0..@2$0)
> 
> It's not a critical issue because it does work to omit $0 -- so my
> immediate problem is solved (getting the sum to calculate). But it
> costs a little extra time because either a/ the manual is wrong or b/
> $0 is supposed to work and there's a bug.
> 

Did this ever work? I've spot-checked back to 6.36c and I cannot find
a release where it actually worked: assuming I haven't made a mistake,
it seems to be an implementation oversight, rather than some patch
specifically breaking the functionality. 

Nick

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

* Re: Table cell refs with @0 or $0 are broken
  2012-04-04 17:17 ` Nick Dokos
@ 2012-04-04 20:24   ` Christian Moe
  2012-04-04 20:59     ` Nick Dokos
  2012-04-04 21:05     ` Nick Dokos
  2012-04-05  0:35   ` James Harkins
  1 sibling, 2 replies; 11+ messages in thread
From: Christian Moe @ 2012-04-04 20:24 UTC (permalink / raw)
  To: nicholas.dokos, jamshark70, Org Mode



On 4/4/12 7:17 PM, Nick Dokos wrote:
> James Harkins<jamshark70@gmail.com>  wrote:
>
>> Don't know if this is fixed in a later org update, but -- the online
>> org manual says that you can refer to table cells in the current row
>> or column using @0 and $0 respectively, but that's definitely not
>> working on my machine.
(...)
>> ** Broken: "Not in table data field"
>> | 1.0 |
>> | 2.0 |
>> |     |
>> #+TBLFM: @>$1=vsum(@1$0..@2$0)
(...)
> Did this ever work? I've spot-checked back to 6.36c and I cannot find
> a release where it actually worked: assuming I haven't made a mistake,
> it seems to be an implementation oversight, rather than some patch
> specifically breaking the functionality.
>
> Nick
>

I find that zero references do work, albeit not quite as one might be 
led to believe by the manual.

Agreed, it does not work in James' example. And agreed, the manual 
seems to me to suggest, to the contrary, that `@1$0' should work. 
Though it does also make clear that the `$0' is superfluous and can be 
omitted, because when only the row is given, the current column is 
taken as implied. So we all agree `@1' works.

But consider the following example, which also works. Here is some 
output from fitting a linear trend in Org-Babel/R. (I've shaved off 
some decimals to fit this in an email.) Computing the TBLFM will round 
the number in each cell to three decimal places.

#+results:
| Record   |        Slope |    ConfLower |    ConfUpper |
|----------+--------------+--------------+--------------|
| GISTEMP  | 0.0173837600 | 0.0133209130 | 0.0214466060 |
| HadCrut3 | 0.0158602890 | 0.0118664610 | 0.0198541180 |
#+TBLFM: @2$2..@>$>=@0;%.3f

Try substituting `$0' for `@0', it works the same. @0 designates the 
current row, and the current column is taken as implied. Ditto when $0 
designates the current column. However, `@0$0' will not work.

It would seem that either one of $0 and @0 on its own in practice 
designates "the current cell".

Also, I can't think of a situation where either would be needed to 
designate a whole column or row respectively.


Yours,
Christian

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

* Re: Table cell refs with @0 or $0 are broken
  2012-04-04 20:24   ` Christian Moe
@ 2012-04-04 20:59     ` Nick Dokos
  2012-04-04 21:05     ` Nick Dokos
  1 sibling, 0 replies; 11+ messages in thread
From: Nick Dokos @ 2012-04-04 20:59 UTC (permalink / raw)
  To: mail; +Cc: jamshark70, Org Mode

Christian Moe <mail@christianmoe.com> wrote:

> 
> 
> On 4/4/12 7:17 PM, Nick Dokos wrote:
> > James Harkins<jamshark70@gmail.com>  wrote:
> >
> >> Don't know if this is fixed in a later org update, but -- the online
> >> org manual says that you can refer to table cells in the current row
> >> or column using @0 and $0 respectively, but that's definitely not
> >> working on my machine.
> (...)
> >> ** Broken: "Not in table data field"
> >> | 1.0 |
> >> | 2.0 |
> >> |     |
> >> #+TBLFM: @>$1=vsum(@1$0..@2$0)
> (...)
> > Did this ever work? I've spot-checked back to 6.36c and I cannot find
> > a release where it actually worked: assuming I haven't made a mistake,
> > it seems to be an implementation oversight, rather than some patch
> > specifically breaking the functionality.
> >
> > Nick
> >
> 
> I find that zero references do work, albeit not quite as one might be 
> led to believe by the manual.
> 
> Agreed, it does not work in James' example. And agreed, the manual 
> seems to me to suggest, to the contrary, that `@1$0' should work. 
> Though it does also make clear that the `$0' is superfluous and can be 
> omitted, because when only the row is given, the current column is 
> taken as implied. So we all agree `@1' works.
> 
> But consider the following example, which also works. Here is some 
> output from fitting a linear trend in Org-Babel/R. (I've shaved off 
> some decimals to fit this in an email.) Computing the TBLFM will round 
> the number in each cell to three decimal places.
> 
> #+results:
> | Record   |        Slope |    ConfLower |    ConfUpper |
> |----------+--------------+--------------+--------------|
> | GISTEMP  | 0.0173837600 | 0.0133209130 | 0.0214466060 |
> | HadCrut3 | 0.0158602890 | 0.0118664610 | 0.0198541180 |
> #+TBLFM: @2$2..@>$>=@0;%.3f
> 
> Try substituting `$0' for `@0', it works the same. @0 designates the 
> current row, and the current column is taken as implied. Ditto when $0 
> designates the current column. However, `@0$0' will not work.
> 

It seems to work for me - although I've been juggling branches and
I may be lost in the forest at this point.

I (think I) am using Org-mode version 7.8.08 (release_7.8.07.206.g76e7b)
and I get no error with James's first example, the "Not in table data
field" error with James' second examples and *no* error with your
example in any of the three cases: $0, @0 or @0$0.

Nick

> It would seem that either one of $0 and @0 on its own in practice 
> designates "the current cell".
> 
> Also, I can't think of a situation where either would be needed to 
> designate a whole column or row respectively.
> 

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

* Re: Table cell refs with @0 or $0 are broken
  2012-04-04 20:24   ` Christian Moe
  2012-04-04 20:59     ` Nick Dokos
@ 2012-04-04 21:05     ` Nick Dokos
  2012-04-04 21:13       ` Christian Moe
  1 sibling, 1 reply; 11+ messages in thread
From: Nick Dokos @ 2012-04-04 21:05 UTC (permalink / raw)
  To: mail; +Cc: jamshark70, Org Mode

Christian Moe <mail@christianmoe.com> wrote:

> 
> 
> On 4/4/12 7:17 PM, Nick Dokos wrote:
> > James Harkins<jamshark70@gmail.com>  wrote:
> >
> >> Don't know if this is fixed in a later org update, but -- the online
> >> org manual says that you can refer to table cells in the current row
> >> or column using @0 and $0 respectively, but that's definitely not
> >> working on my machine.
> (...)
> >> ** Broken: "Not in table data field"
> >> | 1.0 |
> >> | 2.0 |
> >> |     |
> >> #+TBLFM: @>$1=vsum(@1$0..@2$0)
> (...)
> > Did this ever work? I've spot-checked back to 6.36c and I cannot find
> > a release where it actually worked: assuming I haven't made a mistake,
> > it seems to be an implementation oversight, rather than some patch
> > specifically breaking the functionality.
> >
> > Nick
> >
> 
> I find that zero references do work, albeit not quite as one might be 
> led to believe by the manual.
> 
> Agreed, it does not work in James' example. And agreed, the manual 
> seems to me to suggest, to the contrary, that `@1$0' should work. 
> Though it does also make clear that the `$0' is superfluous and can be 
> omitted, because when only the row is given, the current column is 
> taken as implied. So we all agree `@1' works.
> 
> But consider the following example, which also works. Here is some 
> output from fitting a linear trend in Org-Babel/R. (I've shaved off 
> some decimals to fit this in an email.) Computing the TBLFM will round 
> the number in each cell to three decimal places.
> 
> #+results:
> | Record   |        Slope |    ConfLower |    ConfUpper |
> |----------+--------------+--------------+--------------|
> | GISTEMP  | 0.0173837600 | 0.0133209130 | 0.0214466060 |
> | HadCrut3 | 0.0158602890 | 0.0118664610 | 0.0198541180 |
> #+TBLFM: @2$2..@>$>=@0;%.3f
> 
> Try substituting `$0' for `@0', it works the same. @0 designates the 
> current row, and the current column is taken as implied. Ditto when $0 
> designates the current column. However, `@0$0' will not work.
> 

Ah, OK - I'm blind: on rereading it, and retrying it, I see that it just
pushes everything down to 0.000 - but that looks like a different bug to
me, no?

Nick

> It would seem that either one of $0 and @0 on its own in practice 
> designates "the current cell".
> 
> Also, I can't think of a situation where either would be needed to 
> designate a whole column or row respectively.
> 
> 
> Yours,
> Christian
> 
> 
> 

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

* Re: Table cell refs with @0 or $0 are broken
  2012-04-04 21:05     ` Nick Dokos
@ 2012-04-04 21:13       ` Christian Moe
  2012-04-04 22:36         ` Nick Dokos
  0 siblings, 1 reply; 11+ messages in thread
From: Christian Moe @ 2012-04-04 21:13 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: jamshark70, Org Mode

On 4/4/12 11:05 PM, Nick Dokos wrote:
(...)
>> #+TBLFM: @2$2..@>$>=@0;%.3f
>>
>> Try substituting `$0' for `@0', it works the same. @0 designates the
>> current row, and the current column is taken as implied. Ditto when $0
>> designates the current column. However, `@0$0' will not work.
>>
>
> Ah, OK - I'm blind: on rereading it, and retrying it, I see that it just
> pushes everything down to 0.000 - but that looks like a different bug to
> me, no?
>
> Nick

That's what I'm getting, and you're right, it does look different.

Yours,
Christian

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

* Re: Table cell refs with @0 or $0 are broken
  2012-04-04 21:13       ` Christian Moe
@ 2012-04-04 22:36         ` Nick Dokos
  2012-04-09 18:07           ` Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Nick Dokos @ 2012-04-04 22:36 UTC (permalink / raw)
  To: mail; +Cc: jamshark70, Org Mode

Christian Moe <mail@christianmoe.com> wrote:

> On 4/4/12 11:05 PM, Nick Dokos wrote:
> (...)
> >> #+TBLFM: @2$2..@>$>=@0;%.3f
> >>
> >> Try substituting `$0' for `@0', it works the same. @0 designates the
> >> current row, and the current column is taken as implied. Ditto when $0
> >> designates the current column. However, `@0$0' will not work.
> >>
> >
> > Ah, OK - I'm blind: on rereading it, and retrying it, I see that it just
> > pushes everything down to 0.000 - but that looks like a different bug to
> > me, no?
> >
> > Nick
> 
> That's what I'm getting, and you're right, it does look different.
> 

Ah, you shouldn't listen to me: even though it looks different, a patch that
I was trying out to fix James's problem seems to fix this problem too - so
they must be the same after all.

I just added a couple of sanity checks to org-table-get-range so that c1 and
c2 are set to a sane value not only when they are nil but also when they are
0 (around line 2666 or so in org-table.el):

       ...
       (if (not c1) (setq c1 col))
       (if (not c2) (setq c2 col))
       (if (= c1 0) (setq c1 col))
       (if (= c2 0) (setq c2 col))
       ...

Nick

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

* Re: Table cell refs with @0 or $0 are broken
  2012-04-04 17:17 ` Nick Dokos
  2012-04-04 20:24   ` Christian Moe
@ 2012-04-05  0:35   ` James Harkins
  1 sibling, 0 replies; 11+ messages in thread
From: James Harkins @ 2012-04-05  0:35 UTC (permalink / raw)
  To: emacs-orgmode

At Wed, 04 Apr 2012 13:17:54 -0400,
Nick Dokos wrote:
> Did this ever work? I've spot-checked back to 6.36c and I cannot find
> a release where it actually worked: assuming I haven't made a mistake,
> it seems to be an implementation oversight, rather than some patch
> specifically breaking the functionality. 

Thanks, by the way, to all for the quick attention to this! It's some relief, at least, to know that I wasn't grossly misreading the manual :)

James


--
James Harkins /// dewdrop world
jamshark70@dewdrop-world.net
http://www.dewdrop-world.net

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman

blog: http://www.dewdrop-world.net/words
audio clips: http://www.dewdrop-world.net/audio
more audio: http://soundcloud.com/dewdrop_world/tracks

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

* Re: Table cell refs with @0 or $0 are broken
  2012-04-04 22:36         ` Nick Dokos
@ 2012-04-09 18:07           ` Bastien
  2012-04-09 18:13             ` Nick Dokos
  0 siblings, 1 reply; 11+ messages in thread
From: Bastien @ 2012-04-09 18:07 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: jamshark70, Org Mode, mail

Hi Nick,

Nick Dokos <nicholas.dokos@hp.com> writes:

> I just added a couple of sanity checks to org-table-get-range so that c1 and
> c2 are set to a sane value not only when they are nil but also when they are
> 0 (around line 2666 or so in org-table.el):
>
>        ...
>        (if (not c1) (setq c1 col))
>        (if (not c2) (setq c2 col))
>        (if (= c1 0) (setq c1 col))
>        (if (= c2 0) (setq c2 col))
>        ...

Thanks.  I pushed a similar fix for this.

As for the OT's issue, IIUC this is more a documentation issue?

Can anyone submit a doc patch for improving the doc here?

Thanks,

-- 
 Bastien

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

* Re: Table cell refs with @0 or $0 are broken
  2012-04-09 18:07           ` Bastien
@ 2012-04-09 18:13             ` Nick Dokos
  2012-04-09 18:19               ` Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: Nick Dokos @ 2012-04-09 18:13 UTC (permalink / raw)
  To: Bastien; +Cc: jamshark70, Org Mode, mail

Bastien <bzg@gnu.org> wrote:

> As for the OT's issue, IIUC this is more a documentation issue?
> 

I don't think so, but I'm not quite sure: the code fix should take
care of it I think.

Nick

> Can anyone submit a doc patch for improving the doc here?
> 
> Thanks,
> 
> -- 
>  Bastien
> 

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

* Re: Table cell refs with @0 or $0 are broken
  2012-04-09 18:13             ` Nick Dokos
@ 2012-04-09 18:19               ` Bastien
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien @ 2012-04-09 18:19 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: jamshark70, Org Mode, mail

Nick Dokos <nicholas.dokos@hp.com> writes:

> Bastien <bzg@gnu.org> wrote:
>
>> As for the OT's issue, IIUC this is more a documentation issue?
>> 
>
> I don't think so, but I'm not quite sure: the code fix should take
> care of it I think.

Mhh... I just double-checked and that's right.

Thanks!

-- 
 Bastien

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

end of thread, other threads:[~2012-04-09 18:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04  9:35 Table cell refs with @0 or $0 are broken James Harkins
2012-04-04 17:17 ` Nick Dokos
2012-04-04 20:24   ` Christian Moe
2012-04-04 20:59     ` Nick Dokos
2012-04-04 21:05     ` Nick Dokos
2012-04-04 21:13       ` Christian Moe
2012-04-04 22:36         ` Nick Dokos
2012-04-09 18:07           ` Bastien
2012-04-09 18:13             ` Nick Dokos
2012-04-09 18:19               ` Bastien
2012-04-05  0:35   ` James Harkins

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