emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] fix calc-eval date(<timestamp>)


From: Benjamin Andresen
Subject: [O] [PATCH] fix calc-eval date(<timestamp>)
Date: Sat, 09 Jul 2011 15:51:37 +0200
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/23.3 (gnu/linux)

Hello list,

I'm not always up-to-date with the org master lately, so excuse me for
only noticing it now.

The commit 2e20cf9358deb9579ae6a22bc0deb2a772387194 and its parent broke
the following functionality for me:

|   | Items       | Dispatched             | Arrived                | HT     |
|---+-------------+------------------------+------------------------+--------|
| # | Foo bar baz | [2011-07-06 Wed 01:51] | [2011-07-09 Sat 14:00] | #ERROR |
#+TBLFM: $5=(date(<$4>) - date(<$3>))*24*60*60;%i

Before the above commit it would calculate the amount of seconds between
the Dispatched and Arrived time using
$5=(date(<$4>) - date(<$3>))*24*60*60;%i

However with the introduction of org-table-time-string-to-seconds it
broke, because [2011-07-06 Wed 01:51] would match the regexp
"\\([0-9]+\\):\\([0-9]+\\)" and be considered a duration.

I think this patch fixes this.
diff --git a/lisp/org-table.el b/lisp/org-table.el
index fcb6e9e..23118cc 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3213,6 +3213,7 @@ For example:  28 -> AB."
          (sec (string-to-number (match-string 3 s))))
       (+ (* hour 3600) (* min 60) sec)))
    ((and (stringp s)
+        (not (string-match org-ts-regexp-both s))
         (string-match "\\([0-9]+\\):\\([0-9]+\\)" s))
     (let ((min (string-to-number (match-string 1 s)))
          (sec (string-to-number (match-string 2 s))))
Hope that helps and thanks for the good work everyone,
Benjamin Andresen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]