reddit / emacs

Why does C-u C-c C-c place the vsum() in current row of an org-mode table instead of the row mentioned in #+TBLFM?

eminent101 · 2022-07-02 11:20
I have this org-mode table in a file named `1.org`: | . | A | B | C | |---+----+-----+------| | X | 10 | 100 | 1000 | | Y | 20 | 200 | 2000 | | Z | 30 | 300 | 3000 | |---+----+-----+------| | T | | | | #+TBLFM: @5$2..$4=vsum(@I..@II) If I move the cursor to the `#+TBLFM` line and run `C-c C-c`, I get the totals of each column in the last row labelled `T` like so | . | A | B | C | |---+----+-----+------| | X | 10 | 100 | 1000 | | Y | 20 | 200 | 2000 | | Z | 30 | 300 | 3000 | |---+----+-----+------| | T | 60 | 600 | 6000 | #+TBLFM: @5$2..$4=vsum(@I..@II) All good so far. But if instead I place the cursor on the row labelled `Y` (for example, just place the cursor on `Y`) and then run `C-u C-c C-c` I get this | . | A | B | C | |---+-----+------+-------| | X | 10 | 100 | 1000 | | Y | 60 | 600 | 6000 | | Z | 100 | 1000 | 10000 | |---+-----+------+-------| | T | 170 | 1700 | 17000 | #+TBLFM: @5$2..$4=vsum(@I..@II) Why did it place the sum of each column in the row labelled `Y` even though the the `#+TBLFM` clearly says to put the sum in last row (row `@5`)? --- Documentation of `C-u C-c C-c` - https://orgmode.org/manual/Updating-the-table.html > `C-u C-c *` or `C-u C-c C-c` > > Recompute the entire table, line by line. Any lines before the first hline are left alone, assuming that these are part of the table header.
scbagley · 2022-07-02 17:17
If you change the last line to: `#+TBLFM: @5$2..@5$4=vsum(@I..@II)`, the behavior will be what you expect.