branch: externals/org
commit c274128997881513256d57b4de2505603f9be018
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>
org-table-eval-formula: Keep empty result in duration (;TtU) mode
* lisp/org-table.el (org-table-eval-formula): When using T, t, or
U (duration) mode, do not convert empty results into duration. This
is to keep things consistent with default mode.
Reported-by: Jeff Trull <[email protected]>
Link:
https://list.orgmode.org/orgmode/CAF_DUeEFpNU5UXjE80yB1MB9xj5oVLqG=xadnkqcdzwtakw...@mail.gmail.com/
---
lisp/org-table.el | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 535d1b44c3..b1c6ef86d5 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -2657,11 +2657,16 @@ location of point."
form
(calc-eval (cons form calc-modes)
(when (and (not keep-empty) numbers) 'num)))
- ev (if duration (org-table-time-seconds-to-string
- (if (string-match
"^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" ev)
- (string-to-number
(org-table-time-string-to-seconds ev))
- (string-to-number ev))
- duration-output-format)
+ ev (if (and duration
+ ;; When the result is an empty string,
+ ;; keep it empty.
+ ;; See
https://list.orgmode.org/orgmode/CAF_DUeEFpNU5UXjE80yB1MB9xj5oVLqG=xadnkqcdzwtakw...@mail.gmail.com/
+ (not (string-empty-p ev)))
+ (org-table-time-seconds-to-string
+ (if (string-match "^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" ev)
+ (string-to-number (org-table-time-string-to-seconds
ev))
+ (string-to-number ev))
+ duration-output-format)
ev)))
(when org-table-formula-debug