1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-01-15 17:00:45 +00:00

Make @0 reference the last data line in a table.

The last data line in a table is often a line with important data, for
example sums of a column.  In tables with varying length, the row
number of this line is constantly changing, which makes it hard to
write programs creating tables and then installing formulas.

This patch introduces @0 as a special reference to the last row, so
that @0$3 would be the field in the last row, 3rd column.
This commit is contained in:
Carsten Dominik 2008-12-12 08:53:43 +01:00
parent a0cbeb2e82
commit 5ff646fc90
3 changed files with 9 additions and 2 deletions

View File

@ -1781,7 +1781,8 @@ Org also uses another, more general operator that looks like this:
@noindent
Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
or relative to the current column like @samp{+1} or @samp{-2}.
or relative to the current column like @samp{+1} or @samp{-2}. As a special
case, @samp{@@0} references the last data line in the table.
The row specification only counts data lines and ignores horizontal
separator lines (hlines). You can use absolute row numbers

View File

@ -1,3 +1,8 @@
2008-12-12 Carsten Dominik <carsten.dominik@gmail.com>
* org-table.el (org-table-get-specials): Make @0 reference the
last line in a table.
2008-12-11 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-log-done): Fix docstring.

View File

@ -1897,7 +1897,8 @@ For all numbers larger than LIMIT, shift them by DELTA."
(beginning-of-line 2)
(setq l (1+ l)))
(setq org-table-current-line-types (apply 'vector (nreverse types))
org-table-dlines (apply 'vector (cons nil (nreverse dlines)))
org-table-dlines (apply 'vector (cons (car dlines)
(nreverse dlines)))
org-table-hlines (apply 'vector (cons nil (nreverse hlines)))))))
(defun org-table-maybe-eval-formula ()