From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Andresen Subject: [PATCH] fix calc-eval date() Date: Sat, 09 Jul 2011 15:51:37 +0200 Message-ID: <87k4brmuja.fsf@in-ulm.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:37493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfXvN-0004dt-5j for emacs-orgmode@gnu.org; Sat, 09 Jul 2011 09:50:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QfXvL-00073k-Aa for emacs-orgmode@gnu.org; Sat, 09 Jul 2011 09:50:24 -0400 Received: from mail.in-ulm.de ([217.10.8.10]:51200) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QfXvK-00073g-RZ for emacs-orgmode@gnu.org; Sat, 09 Jul 2011 09:50:23 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=bla.patch 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)))) --=-=-= Content-Type: text/plain Hope that helps and thanks for the good work everyone, Benjamin Andresen --=-=-=--