Sfoglia il codice sorgente

org-table.el: Fix bug in ̀org-table-maybe-eval-formula'.

* org-table.el (org-table-store-formulas): Fix typo.
(org-table-maybe-eval-formula): Fix the regexp to only match
formulas, which never end with the `=' character.  If the
field only contain this character, don't eval either.

Thanks to Thomas S. Dye for reporting this.
Bastien Guerry 13 anni fa
parent
commit
8342fdb70a
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      lisp/org-table.el

+ 2 - 2
lisp/org-table.el

@@ -2097,7 +2097,7 @@ When NAMED is non-nil, look for a named equation."
 	    (goto-char (match-beginning 3))
 	    (delete-region (match-beginning 3) (match-end 0)))
 	(org-indent-line-function)
-	(insert (or (match-string 2) "#+TBLFM")))
+	(insert (or (match-string 2) "#+TBLFM:")))
       (insert " "
 	      (mapconcat (lambda (x)
 			   (concat
@@ -2276,7 +2276,7 @@ If yes, store the formula and apply it."
   (when org-table-formula-evaluate-inline
     (let* ((field (org-trim (or (org-table-get-field) "")))
 	   named eq)
-      (when (string-match "^:?=\\(.*\\)" field)
+      (when (string-match "^:?=\\(.*[^=]\\)$" field)
 	(setq named (equal (string-to-char field) ?:)
 	      eq (match-string 1 field))
 	(if (or (fboundp 'calc-eval)