[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Bug: Table formula does not copy time interval correctly [8.2.10
From: |
Michael Brand |
Subject: |
Re: [O] Bug: Table formula does not copy time interval correctly [8.2.10 (release_8.2.10 @ /usr/share/emacs/25.0.94/lisp/org/)] |
Date: |
Sun, 10 Jul 2016 16:38:54 +0200 |
Hi Rares
On Fri, Jul 8, 2016 at 6:06 AM, Rares Vernica <address@hidden> wrote:
> Just to clarify, how would you fix this:
>
> | [2016-07-05 Tue]--[2016-07-06 Wed] | 1d | vsum(d) |
> | [2016-07-06 Wed]--[2016-07-07 Thu] | 1d | 2 d |
> #+TBLFM: $3=vsum(@address@hidden)
>
> Notice the "vsum(d)" instead of the expected "1 d".
Depending on the number of fields in a range Org builds just a value
or a Calc vector of values. This is due to the comparison of r1/r2 and
c1/c2 which are the row and column beginning and end of the range in
the function org-table-get-range:
(if (and (not corners-only)
(or (not rangep) (and (= r1 r2) (= c1 c2))))
;; Just one field.
[...]
;; A range, return a vector.
[...])
I can not think of any use case where this should be more useful than
substituting ~(and (= r1 r2) (= c1 c2))~ with ~nil~. But since this
substitution could break existing usage I suggest to add ~vec~ to the
Calc formula:
| [2016-07-05 Tue]--[2016-07-06 Wed] | 1d | d | [d] | d |
| [2016-07-06 Wed]--[2016-07-07 Thu] | 1d | [d, d] | [[d, d]] | 2 d |
#+TBLFM: $3 = @address@hidden :: $4 = vec(@address@hidden) :: $5 =
vsum(vec(@address@hidden))
Michael