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.
This commit is contained in:
Nicolas Goaziou 2017-01-17 10:19:05 +01:00
parent a2950b00c1
commit 1619aee376
2 changed files with 10 additions and 8 deletions

View file

@ -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)))

View file

@ -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")))