mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 18:36:26 +00:00
org-table: Fix column formulas
* lisp/org-table.el (org-table-recalculate): Fix column formulas in tables consisting of a single row group. Reported-by: Michael Welle <mwe012008@gmx.net> <http://permalink.gmane.org/gmane.emacs.orgmode/108886>
This commit is contained in:
parent
b7c144a104
commit
2dfdafd35a
|
@ -3199,8 +3199,8 @@ existing formula for column %s"
|
|||
(re-search-forward org-table-hline-regexp end t)
|
||||
(re-search-forward org-table-dataline-regexp end t))
|
||||
(setq beg (match-beginning 0)))
|
||||
;; Just leave BEG where it is.
|
||||
(t (setq beg (line-beginning-position)))))
|
||||
;; Just leave BEG at the start of the table.
|
||||
(t nil)))
|
||||
(setq beg (line-beginning-position)
|
||||
end (copy-marker (line-beginning-position 2))))
|
||||
(goto-char beg)
|
||||
|
|
|
@ -1909,6 +1909,33 @@ is t, then new columns should be added as needed"
|
|||
(org-table-calc-current-TBLFM)
|
||||
(buffer-string)))))
|
||||
|
||||
(ert-deftest test-org-table/single-rowgroup ()
|
||||
"Test column formula in a table with a single rowgroup."
|
||||
(should
|
||||
(equal
|
||||
"
|
||||
|---+---|
|
||||
| 1 | 0 |
|
||||
|---+---|
|
||||
#+TBLFM: $2=$1-1"
|
||||
(org-test-with-temp-text "
|
||||
|---+---|
|
||||
| 1 | |
|
||||
|---+---|
|
||||
<point>#+TBLFM: $2=$1-1"
|
||||
(org-table-calc-current-TBLFM)
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal
|
||||
"
|
||||
| 1 | 0 |
|
||||
#+TBLFM: $2=$1-1"
|
||||
(org-test-with-temp-text "
|
||||
| 1 | |
|
||||
<point>#+TBLFM: $2=$1-1"
|
||||
(org-table-calc-current-TBLFM)
|
||||
(buffer-string)))))
|
||||
|
||||
|
||||
(provide 'test-org-table)
|
||||
|
||||
|
|
Loading…
Reference in a new issue