org-table: Fix #ERROR in table formula with "@>"

* lisp/org-table.el (org-table-eval-formula): Expand first and last
  references into proper fields coordinates before replacing ranges.

Reported-by: Pablo S. Casas <pabloscasas@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/105895>
This commit is contained in:
Nicolas Goaziou 2016-03-25 22:17:08 +01:00
parent 780445c0aa
commit 0b077de733

View file

@ -2738,9 +2738,10 @@ not overwrite the stored one."
(setq fmt (replace-match "" t t fmt))) (setq fmt (replace-match "" t t fmt)))
(unless (string-match "\\S-" fmt) (unless (string-match "\\S-" fmt)
(setq fmt nil)))) (setq fmt nil))))
(if (and (not suppress-const) org-table-formula-use-constants) (when (and (not suppress-const) org-table-formula-use-constants)
(setq formula (org-table-formula-substitute-names formula))) (setq formula (org-table-formula-substitute-names formula)))
(setq orig (or (get-text-property 1 :orig-formula formula) "?")) (setq orig (or (get-text-property 1 :orig-formula formula) "?"))
(setq formula (org-table-formula-handle-first/last-rc formula))
(while (> ndown 0) (while (> ndown 0)
(setq fields (org-split-string (setq fields (org-split-string
(org-trim (org-trim