From e7e5e25100246e5eab3a36034ac2de578dabd02f Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 13 Apr 2008 21:28:26 +0200 Subject: [PATCH] Fix bug with algebraic evaluation in tables. There was a problem that complex fields need a pair of parenthesis around them. For example, if one field is "a a" and another field is "a+b", multiplication of the two gave "a^3+b" instead of "a^3+a^2 b". Now variable replacement puts extra parenthesis around values. --- ChangeLog | 4 ++++ lisp/org-table.el | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6197e9d16..6ea441fc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-04-13 Carsten Dominik + * lisp/org-table.el (org-table-make-reference): Extra parenthesis + around single fields, to make sure that algebraic formulas get + correctly interpreted by calc. + * lisp/org-mhe.el: Changed author name to Thomas Baumann. * lisp/org-exp.el (org-export-preprocess-string): Renamed-from diff --git a/lisp/org-table.el b/lisp/org-table.el index 01bad0cae..fc790eaef 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -2298,7 +2298,8 @@ LISPP means to return something appropriate for a Lisp list." elements (prin1-to-string (if numbers (string-to-number elements) elements))) (if (equal elements "") (setq elements "0")) - (if numbers (number-to-string (string-to-number elements)) elements)) + (if numbers (setq elements (number-to-string (string-to-number elements)))) + (concat "(" elements ")")) (unless keep-empty (setq elements (delq nil