Org-mode mailing list
 help / color / mirror / 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

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git