emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] fix calc-eval date(<timestamp>)
@ 2011-07-09 13:51 Benjamin Andresen
  2011-07-09 15:48 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Andresen @ 2011-07-09 13:51 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bla.patch --]
[-- Type: text/x-patch, Size: 487 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 74 bytes --]


Hope that helps and thanks for the good work everyone,
Benjamin Andresen

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-09 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-09 13:51 [PATCH] fix calc-eval date(<timestamp>) Benjamin Andresen
2011-07-09 15:48 ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).