emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@mbork.pl>
To: Org-Mode mailing list <emacs-orgmode@gnu.org>
Subject: A small fix in `org-read-date-analyze'
Date: Thu, 17 Mar 2016 12:52:58 +0100	[thread overview]
Message-ID: <8760wlgw2t.fsf@mbork.pl> (raw)

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

Hi,

I attach a simple patch to enhance handling of two-digit years in
`org-read-date-analyze'.  (I have the FSF papers signed.)

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Enhance-year-handling.patch --]
[-- Type: text/x-patch, Size: 908 bytes --]

From 6406c46fe1394b107e87012696f058fe5f13215e Mon Sep 17 00:00:00 2001
From: Marcin Borkowski <mbork@mbork.pl>
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 1f06cbd..9b3af05 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)))
+      (when (< year 100) (setq year (org-small-year-to-year year)))
       (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
 			       t nil ans)))
 
-- 
2.4.3


             reply	other threads:[~2016-03-17 11:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17 11:52 Marcin Borkowski [this message]
2016-03-17 12:02 ` A small fix in `org-read-date-analyze' Marcin Borkowski
2016-03-17 22:12   ` Nicolas Goaziou
2016-03-18  5:40     ` Marcin Borkowski
2016-03-18 13:34       ` Nicolas Goaziou
2016-03-18 16:51         ` A proposed enhancement in entering timestamps (was: A small fix in `org-read-date-analyze') Marcin Borkowski
2016-03-18 19:02           ` A proposed enhancement in entering timestamps Samuel W. Flint
2016-03-18 20:26           ` Eric S Fraga
2016-03-22 20:28           ` A proposed enhancement in entering timestamps (was: A small fix in `org-read-date-analyze') Marcin Borkowski
2016-03-24 13:09             ` A proposed enhancement in entering timestamps Nicolas Goaziou
2016-03-24 15:03               ` Marcin Borkowski
2016-03-24 15:30                 ` Robert Horn
2016-03-24 19:38                   ` Marcin Borkowski

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=8760wlgw2t.fsf@mbork.pl \
    --to=mbork@mbork.pl \
    --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).