Browse Source

Fix last commit

* lisp/org-table.el (org-table-eval-formula): Result is not always a string.
* testing/lisp/test-org-table.el (test-org-table/copy-field): Update
  test.
Nicolas Goaziou 8 năm trước cách đây
mục cha
commit
1619aee376
2 tập tin đã thay đổi với 10 bổ sung8 xóa
  1. 8 6
      lisp/org-table.el
  2. 2 2
      testing/lisp/test-org-table.el

+ 8 - 6
lisp/org-table.el

@@ -2910,12 +2910,14 @@ $1->    %s\n" orig formula form0 form))
 	(when (consp ev) (setq fmt nil ev "#ERROR"))
 	(org-table-justify-field-maybe
 	 (format org-table-formula-field-format
-		 (if fmt (format fmt (string-to-number ev))
-		   ;; Replace any active time stamp in the result with
-		   ;; an inactive one.  Dates in tables are likely
-		   ;; piece of regular data, not meant to appear in
-		   ;; the agenda.
-		   (replace-regexp-in-string org-ts-regexp "[\\1]" ev))))
+		 (cond
+		  ((not (stringp ev)) ev)
+		  (fmt (format fmt (string-to-number ev)))
+		  ;; Replace any active time stamp in the result with
+		  ;; an inactive one.  Dates in tables are likely
+		  ;; piece of regular data, not meant to appear in the
+		  ;; agenda.
+		  (t (replace-regexp-in-string org-ts-regexp "[\\1]" ev)))))
 	(if (and down (> ndown 0) (looking-at ".*\n[ \t]*|[^-]"))
 	    (call-interactively 'org-return)
 	  (setq ndown 0)))

+ 2 - 2
testing/lisp/test-org-table.el

@@ -642,7 +642,7 @@ See also `test-org-table/remote-reference-access'."
 | c   d            | c   d            |
 |                  |                  |
 | 2012-12          | 2012-12          |
-| [2012-12-31 Mon] | <2012-12-31 Mon> |
+| [2012-12-31 Mon] | [2012-12-31 Mon] |
 "
      1 (concat "#+TBLFM: $2 = if(\"$1\" == \"nan\", "
 	       "string(\"\"), string(subvec(\"$1\", 2, vlen(\"$1\")))); E"))
@@ -656,7 +656,7 @@ See also `test-org-table/remote-reference-access'."
 | c   d            | c d              |
 |                  |                  |
 | 2012-12          | 2000             |
-| [2012-12-31 Mon] | <2012-12-31 Mon> |
+| [2012-12-31 Mon] | [2012-12-31 Mon] |
 "
      1 "#+TBLFM: $2 = if(\"$1\" == \"nan\", string(\"\"), $1); E")))