From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Borkowski Subject: Re: A small fix in `org-read-date-analyze' Date: Thu, 17 Mar 2016 13:02:08 +0100 Message-ID: <874mc5gvnj.fsf@mbork.pl> References: <8760wlgw2t.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agWdP-0002Tq-RR for emacs-orgmode@gnu.org; Thu, 17 Mar 2016 08:02:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1agWdL-0005wT-R2 for emacs-orgmode@gnu.org; Thu, 17 Mar 2016 08:02:35 -0400 Received: from mail.mojserwer.eu ([2a01:5e00:2:52::8]:55528) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1agWdL-0005wE-JK for emacs-orgmode@gnu.org; Thu, 17 Mar 2016 08:02:31 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id A4280A1B9B7 for ; Thu, 17 Mar 2016 13:02:18 +0100 (CET) Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FmIQtOm9eDYQ for ; Thu, 17 Mar 2016 13:02:08 +0100 (CET) Received: from localhost (unknown [150.254.76.84]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 74087A1B9A9 for ; Thu, 17 Mar 2016 13:02:08 +0100 (CET) In-reply-to: <8760wlgw2t.fsf@mbork.pl> 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: Org-Mode mailing list --=-=-= Content-Type: text/plain On 2016-03-17, at 12:52, Marcin Borkowski wrote: > Hi, > > I attach a simple patch to enhance handling of two-digit years in > `org-read-date-analyze'. (I have the FSF papers signed.) A better version (sorry for the noise). Best, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Enhance-year-handling.patch >From e98af1606de2479835da797e88eba332cabb233a Mon Sep 17 00:00:00 2001 From: Marcin Borkowski Date: Thu, 17 Mar 2016 12:50:12 +0100 Subject: [PATCH] Enhance year handling * lisp/org.el (org-read-date-analyze): Handle two-digit years with `org-small-year-to-year' instead of just adding 2000 --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 1f06cbd..5adb370 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17011,7 +17011,7 @@ user." (string-to-number (format-time-string "%Y")))) month (string-to-number (match-string 3 ans)) day (string-to-number (match-string 4 ans))) - (when (< year 100) (setq year (+ 2000 year))) + (setq year (org-small-year-to-year year)) (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) t nil ans))) @@ -17035,7 +17035,7 @@ user." (string-to-number (format-time-string "%Y")))) month (string-to-number (match-string 1 ans)) day (string-to-number (match-string 2 ans))) - (when (< year 100) (setq year (+ 2000 year))) + (setq year (org-small-year-to-year year)) (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) t nil ans))) ;; Help matching am/pm times, because `parse-time-string' does not do that. -- 2.4.3 --=-=-=--