emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in formula updates when sorting table (and inserting hlines)


From: Peder Stray
Subject: Bug in formula updates when sorting table (and inserting hlines)
Date: Thu, 1 Apr 2021 23:20:37 +0200

Hi!

I have noticed a few times that sorting tables with C-c ^ does not update the formulas it contains.  This has bitten me quite a bit, so it's good i have backups :)

Here is a minimal example:

|  A | B |
|----+---|
|    | 5 |
|    | 4 |
|  8 | 3 |
|  6 | 2 |
|    | 1 |
|----+---|
| 14 |   |
#+TBLFM: @4$1=@2$2+@4$2::@5$1=@3$2+@5$2::@7$1=vsum(@I..@II)
 
Sorting in column B (between the hlines) with C-c ^ n, moves the lines around as you would expect, but notice that there are no changes in the TBLFM line.  A C-u C-u C-c * after a sort should not change the values, but of course it does in this example. The TBLMF line should have been changed to:#+TBLFM:

@4$1=@6$2+@4$2::@3$1=@5$2+@3$2::@7$1=vsum(@I..@II)

One could also try adding a hline between the 8 and the 6 in the original table by typing C-c -, assuming no values in the table should change from it, the formula line should update  @I..@II to @I..@III.

I would really appreciate it if someone with more knowledge of the org-mode guts could have a look at this and come up with a solution :)

--
  Peder Stray

reply via email to

[Prev in Thread] Current Thread [Next in Thread]