From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Re: Date Prompt Bug (or Anomoly) Date: Tue, 08 Jun 2010 18:27:29 -0400 Message-ID: <16364.1276036049@alphaville.usa.hp.com> References: <876322hcps.wl%ded-law@ddoherty.net> <87k4qfp4ky.fsf@noorul.maa.corp.collab.net> <87fx13p4i5.fsf@noorul.maa.corp.collab.net> <87k4qfuoex.fsf@eee.lan> <0C1D8B23-6AC5-4BC5-806F-43CEE66ECED9@gmail.com> <4C0A8CDA.3000104@ddoherty.net> <7A899B01-66C7-44BF-929A-9E4EED78BE91@gmail.com> <87pr012qzr.wl%ded-law@ddoherty.net> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=47201 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OM7Gg-00080N-RV for emacs-orgmode@gnu.org; Tue, 08 Jun 2010 18:27:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OM7Ge-0007N9-FC for emacs-orgmode@gnu.org; Tue, 08 Jun 2010 18:27:34 -0400 Received: from g1t0029.austin.hp.com ([15.216.28.36]:33460) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OM7Ge-0007Mj-AE for emacs-orgmode@gnu.org; Tue, 08 Jun 2010 18:27:32 -0400 In-Reply-To: Message from Daniel E. Doherty of "Tue, 08 Jun 2010 15:45:12 CDT." <87pr012qzr.wl%ded-law@ddoherty.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Daniel E. Doherty" Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org, "Daniel E. Doherty" , Carsten Dominik Daniel E. Doherty wrote: > > Carsten, > > When I tried this last Saturday, I was reluctant to reply since the git > server appeared to be down and your message made me think I did not have > the latest git version. I tried it again today, and still no joy. I am > using org-mode version 6.36a on emacs 23.1 on ubuntu. > > The latest entry in the Changelog file is > ,---- > | 2010-06-08 Christian Egli > | > | * org-taskjuggler.el (org-export-taskjuggler-old-level): > | define local variable to avoid compiler warning. > `---- > > The following is straight from an org file: > > ,---- > | Attempted on: <2010-06-08 Tue>. > | Entering "3/21": <2021-07-03 Sat>. > | Entering "7/21": <2021-07-07 Wed>. > `---- > > I assume that the fix would be in the function org-read-date-analyze, > but I see no recent Changelog entries mentioning it. Is it possible > this got lost while the git server was down? > No, it is fixed by the following commit, but 6.36a is too old to include it. Either you did not get the updates you thought you did, or you did not remake your org, or you did not reload the newly made org. Try git show 420dd96768262cb15c8bcf4fa6386361e0327add in your git repository to see whether you have the update. If you don't, pull again. If you do have it, do make clean; make and in emacs M-x org-reload Then M-x org-version should say something like: Org-mode version 6.36trans (release_6.36.155.g420d) HTH, Nick --------------------------------------------------------------------------- commit 420dd96768262cb15c8bcf4fa6386361e0327add Author: Carsten Dominik Date: Fri Jun 4 12:29:31 2010 +0200 Fix the date prompt for american-style dates * lisp/org.el (org-read-date-analyze): Fix regular expression for matching american dates Daniel E. Doherty writes: > In playing around with the date prompt (C-.), I ran across the following > puzzling behavior from rather simple inputs. > > I entered the following on June 1, 2010. Here is a date entered as > "3/15": <2011-03-15 Tue>. It interpreted it as the upcoming March 15 as > expected. > > But here is a date entered as "5/21": <2021-06-05 Sat>. Note how it > interpreted the "21" as the year 2021, not at all what I expected from > the documentation or the analogous "3/15" example. > > Maybe there is some underlying logic here that I'm not getting. Perhaps > it has to do with how 2-digit years are interpreted? > > What's going on here? I am using org-version 6.36trans on emacs 23.1. What was going on here is that the regular expression for matching american-style dates was wrong. It was looking for month numbers in the second field and day numbers in the first field - wrong, of course. diff --git a/lisp/org.el b/lisp/org.el index 64044b4..48fd215 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13942,10 +13942,15 @@ The prompt will suggest to enter an ISO date, but you can also enter anything which will at least partially be understood by `parse-time-string'. Unrecognized parts of the date will default to the current day, month, year, hour and minute. If this command is called to replace a timestamp at point, -of to enter the second timestamp of a range, the default time is taken from the -existing stamp. For example, +of to enter the second timestamp of a range, the default time is taken +from the existing stamp. Furthermore, the command prefers the future, +so if you are giving a date where the year is not given, and the day-month +combination is already past in the current year, it will assume you +mean next year. For details, see the manual. A few examples: + 3-2-5 --> 2003-02-05 feb 15 --> currentyear-02-15 + 2/15 --> currentyear-02-15 sep 12 9 --> 2009-09-12 12:45 --> today 12:45 22 sept 0:34 --> currentyear-09-22 0:34 @@ -14191,7 +14196,7 @@ user." t nil ans))) ;; Help matching american dates, like 5/30 or 5/30/7 (when (string-match - "^ *\\([0-3]?[0-9]\\)/\\([0-1]?[0-9]\\)\\(/\\([0-9]+\\)\\)?\\([^/0-9]\\|$\\)" ans) + "^ *\\(0?[1-9]\\|1[012]\\)/\\(0?[1-9]\\|[12][0-9]\\|3[01]\\)\\(/\\([0-9]+\\)\\)?\\([^/0-9]\\|$\\)" ans) (setq year (if (match-end 4) (string-to-number (match-string 4 ans)) (progn (setq kill-year t)