emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Benjamin Andresen <benny@in-ulm.de>
To: emacs-orgmode@gnu.org
Subject: [PATCH] fix calc-eval date(<timestamp>)
Date: Sat, 09 Jul 2011 15:51:37 +0200	[thread overview]
Message-ID: <87k4brmuja.fsf@in-ulm.de> (raw)

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

             reply	other threads:[~2011-07-09 13:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-09 13:51 Benjamin Andresen [this message]
2011-07-09 15:48 ` [PATCH] fix calc-eval date(<timestamp>) Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k4brmuja.fsf@in-ulm.de \
    --to=benny@in-ulm.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).