emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Peder Stray <peder.stray@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Bug in formula updates when sorting table (and inserting hlines)
Date: Thu, 1 Apr 2021 23:20:37 +0200	[thread overview]
Message-ID: <CAE4U0JEf2PSumYYRtnXTx7W80_cGQf+okmXii8vRb-j8s8cq8Q@mail.gmail.com> (raw)

[-- 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 --]

                 reply	other threads:[~2021-04-01 21:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAE4U0JEf2PSumYYRtnXTx7W80_cGQf+okmXii8vRb-j8s8cq8Q@mail.gmail.com \
    --to=peder.stray@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).