emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug in formula updates when sorting table (and inserting hlines)
@ 2021-04-01 21:20 Peder Stray
  0 siblings, 0 replies; only message in thread
From: Peder Stray @ 2021-04-01 21:20 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2410 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-01 21:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 21:20 Bug in formula updates when sorting table (and inserting hlines) Peder Stray

Code repositories for project(s) associated with this 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).