[O] can't assign to hline relative reference:

2015-06-26 Thread Marijn Schouten (hkBst)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dear list,

Consider the following small org table:

|   | grade | weight | weighed grade |
|---+---++---|
|   | 5 | 10 |50 |
|---+---++---|
| total |   || 0 |
#+TBLFM: @II$2=vsum(@I$2..@II-1$2)::$4=$2*$3

In the version of org (8.2.10) distributed with emacs 24.5, evaluating this 
table does not produces the expected result of column 2 being summed to a total 
of 5. Instead depending on point both the second and first columns will get an 
additional 5.

Through irc I found someone who tested this with the latest development version 
as of now and it instead produces the error: can't assign to hline relative 
reference. That also does not seem like the right behavior to me.

Could someone shed some light on the situation?

Marijn 

-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iEYEARECAAYFAlWNQasACgkQp/VmCx0OL2yYagCgwLUWq7sP/GhJAfkwajCAvHRP
u+kAmwcV1GjT0Lbyo0Mrj6F87q+e/uib
=wIrP
-END PGP SIGNATURE-



[O] can't assign to hline relative reference

2015-08-31 Thread Luke Swart
Hello,

There seems to be an error when using hline-relative references in an
org-mode table’s formula. For example, I have the following org-mode table:

#+BEGIN: columnview :hlines 1 :id global
| /Project/  | Mon | Tue | Wed |  Thu | Fri |  Sat | Sun | /Total/ |
|+-+-+-+--+-+--+-+-|
| AnotherProduct | | | |  | | 2.50 | | |
| Prototype  | | | | 3.50 | |  | | |
|+-+-+-+--+-+--+-+-|
| /Daily/| | | |  | |  | | |
#+TBLFM: @I$9..@II$9=vsum($2..$8);%.2f;::@II$2..@III$9='(format
"%3.2f" (apply '+ '(@I..@II)));N;

and I get the error can't assign to hline relative reference when I run M-x
org-table-recalculate. I looked over the org-mode references documentation
 and the gmane.org forums
, but I did not find
any reasons as to why the hline relative references could not be assigned.

This issue is related to the timesheet package on MELPA. I have filed an
issue here: https://github.com/tmarble/timesheet.el/issues/3 but hopefully
I have found the underlying problem, and hopefully it is reasonably fixable.

Here is some relevant info:

   -

   Org-mode version 8.3.1 (8.3.1-87-g4ef2c0-elpa @
   /home/luke/.emacs.d/elpa/org-20150824/)
   -

   emacs-version: 24.5.1
   -

   ArchLinux OS: Linux 4.1.6-1-ARCH #1 SMP PREEMPT Mon Aug 17 08:52:28 CEST
   2015 x86_64 GNU/Linux

This is a copy of my question posted here:
http://emacs.stackexchange.com/questions/15185/cant-assign-to-hline-relative-reference

Any suggestions or guidance would be appreciated. I am happy to clarify
anything as well.

Thanks,
Luke
​


Re: [O] can't assign to hline relative reference:

2015-06-26 Thread Nicolas Goaziou
Hello,

"Marijn Schouten (hkBst)"  writes:

> Through irc I found someone who tested this with the latest
> development version as of now and it instead produces the error: can't
> assign to hline relative reference. That also does not seem like the
> right behavior to me.
>
> Could someone shed some light on the situation?

See .

Regards,

-- 
Nicolas Goaziou



Re: [O] can't assign to hline relative reference:

2015-06-26 Thread Marijn Schouten (hkBst)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 26-06-15 14:22, Nicolas Goaziou wrote:
> Hello,
> 
> "Marijn Schouten (hkBst)"  writes:
> 
>> Through irc I found someone who tested this with the latest
>> development version as of now and it instead produces the error: can't
>> assign to hline relative reference. That also does not seem like the
>> right behavior to me.
>>
>> Could someone shed some light on the situation?
> 
> See .
> 
> Regards,

Thanks Nicolas for that link.

It says that there is a known issue with hline references on the left side of 
table formulas, but I did not quite understand the details.

There seems to be a proposed fix by interpreting said references as ranges with 
the same on both sides, for example @II$2 would become @II$2..@II$2 and would 
then be interpreted properly. Was the issue with this fix that it does not work 
in all cases?

There also seems to be some counterintuitive use of these references that is 
useful to some people and included in the tests and fixing the issue would 
interfere with that use. If I said that right, could someone explain the 
details of this?

There was a mention that fixing the issue might involve rewriting much of 
org-table. Is that a concern?

Marijn
-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iEYEARECAAYFAlWNTMoACgkQp/VmCx0OL2yt1ACZAcFxBtcRwhZ6IPPA02xZtrSk
9xEAn3aY1JKYJkoy1bzhOV4mFbc8UDz7
=0uQ0
-END PGP SIGNATURE-



Re: [O] can't assign to hline relative reference:

2015-07-02 Thread Nicolas Goaziou
"Marijn Schouten (hkBst)"  writes:

> It says that there is a known issue with hline references on the left
> side of table formulas, but I did not quite understand the details.

To tell the truth, this is not crystal clear to me either.

> There seems to be a proposed fix by interpreting said references as
> ranges with the same on both sides, for example @II$2 would become
> @II$2..@II$2 and would then be interpreted properly. Was the issue
> with this fix that it does not work in all cases?

A solution properly handling all cases of @I and al. on lhs is welcome.
Meanwhile, I'd rather use a consistent error than provide something that
just partly works.

> There was a mention that fixing the issue might involve rewriting much
> of org-table. Is that a concern?

Not really, as long as invasive changes are covered by tests.

Regards,



Re: [O] can't assign to hline relative reference

2015-09-01 Thread Nicolas Goaziou
Hello,

Luke Swart  writes:

> There seems to be an error when using hline-relative references in an
> org-mode table’s formula. For example, I have the following org-mode table:
>
> #+BEGIN: columnview :hlines 1 :id global
> | /Project/  | Mon | Tue | Wed |  Thu | Fri |  Sat | Sun | /Total/ |
> |+-+-+-+--+-+--+-+-|
> | AnotherProduct | | | |  | | 2.50 | | |
> | Prototype  | | | | 3.50 | |  | | |
> |+-+-+-+--+-+--+-+-|
> | /Daily/| | | |  | |  | | |
> #+TBLFM: @I$9..@II$9=vsum($2..$8);%.2f;::@II$2..@III$9='(format
> "%3.2f" (apply '+ '(@I..@II)));N;
>
> and I get the error can't assign to hline relative reference when I run M-x
> org-table-recalculate. I looked over the org-mode references documentation
>  and the gmane.org forums
> , but I did not find
> any reasons as to why the hline relative references could not be
> assigned.

This is a known limitation: hline relative references are not allowed on
the left hand side of a formula. The error message you get should be
explicit.

There are apparently subtle problems, IIRC, as pointed out in
.


Regards,

-- 
Nicolas Goaziou



Re: [O] can't assign to hline relative reference

2015-09-01 Thread Luke Swart
Hi Nicolas Goaziou,

Thanks very much for your clarification:

hline relative references are not allowed on the left hand side of a formula

My error message was user-error: Can't assign to hline relative reference,
which now makes sense. Still, a lot of folks didn’t understand the original
message, myself included. I will update my SO post and the Github issue to
reflect this new information.

Still, I am confused because it seems like org-mode used to allow hline
references to be assigned, no? My code snippet was taken from a section in
the timesheet.el MELPA package, which was working fine until an org-mode
update broke it. I may be missing something, so I am not sure if this is
the case.

Anyway, your response is very much appreciated!

Thanks,

Luke

On Tue, Sep 1, 2015 at 12:47 AM, Nicolas Goaziou 
wrote:

Hello,
>
> Luke Swart  writes:
>
> > There seems to be an error when using hline-relative references in an
> > org-mode table’s formula. For example, I have the following org-mode
> table:
> >
> > #+BEGIN: columnview :hlines 1 :id global
> > | /Project/  | Mon | Tue | Wed |  Thu | Fri |  Sat | Sun |
> /Total/ |
> >
>  |+-+-+-+--+-+--+-+-|
> > | AnotherProduct | | | |  | | 2.50 | |
>|
> > | Prototype  | | | | 3.50 | |  | |
>|
> >
>  |+-+-+-+--+-+--+-+-|
> > | /Daily/| | | |  | |  | |
>|
> > #+TBLFM: @I$9..@II$9=vsum($2..$8);%.2f;::@II$2..@III$9='(format
> > "%3.2f" (apply '+ '(@I..@II)));N;
> >
> > and I get the error can't assign to hline relative reference when I run
> M-x
> > org-table-recalculate. I looked over the org-mode references
> documentation
> >  and the gmane.org forums
> > , but I did not
> find
> > any reasons as to why the hline relative references could not be
> > assigned.
>
> This is a known limitation: hline relative references are not allowed on
> the left hand side of a formula. The error message you get should be
> explicit.
>
> There are apparently subtle problems, IIRC, as pointed out in
> .
>
>
> Regards,
>
> --
> Nicolas Goaziou
>
​


Re: [O] can't assign to hline relative reference

2015-09-01 Thread Nicolas Goaziou
Luke Swart  writes:

> Still, I am confused because it seems like org-mode used to allow hline
> references to be assigned, no?

As Carsten pointed out, that was a bug, as Org couldn't expand them
correctly anyway. As a consequence, an error is now thrown.

Regards,