Merge branch 'maint'

Conflicts:
	testing/lisp/test-org.el
This commit is contained in:
Nicolas Goaziou 2012-10-12 18:22:04 +02:00
commit 56470de26d
2 changed files with 24 additions and 6 deletions

View file

@ -15596,14 +15596,13 @@ user."
;; Help matching dotted european dates
(when (string-match
"^ *\\(3[01]\\|0?[1-9]\\|[12][0-9]\\)\\. ?\\(0?[1-9]\\|1[012]\\)\\. ?\\([1-9][0-9][0-9][0-9]\\)?" ans)
(setq year (if (match-end 3)
(string-to-number (match-string 3 ans))
(progn (setq kill-year t)
(string-to-number (format-time-string "%Y"))))
"^ *\\(3[01]\\|0?[1-9]\\|[12][0-9]\\)\\. ?\\(0?[1-9]\\|1[012]\\)\\.\\( ?[1-9][0-9]\\{3\\}\\)?" ans)
(setq year (if (match-end 3) (string-to-number (match-string 3 ans))
(setq kill-year t)
(string-to-number (format-time-string "%Y")))
day (string-to-number (match-string 1 ans))
month (string-to-number (match-string 2 ans))
ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
ans (replace-match (format "%04d-%02d-%02d" year month day)
t nil ans)))
;; Help matching american dates, like 5/30 or 5/30/7

View file

@ -75,6 +75,25 @@
(buffer-string))))))
;;; Date Analysis
(ert-deftest test-org/org-read-date ()
"Test `org-read-date' specifications."
;; Parse ISO date with abbreviated year and month.
(should (equal "2012-03-29 16:40"
(let ((org-time-was-given t))
(org-read-date t nil "12-3-29 16:40"))))
;; Parse Europeans dates.
(should (equal "2012-03-29 16:40"
(let ((org-time-was-given t))
(org-read-date t nil "29.03.2012 16:40"))))
;; Parse Europeans dates without year.
(should (string-match "2[0-9]\\{3\\}-03-29 16:40"
(let ((org-time-was-given t))
(org-read-date t nil "29.03. 16:40")))))
;;; Filling