aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStephen Gildea2019-10-09 09:19:10 -0700
committerStephen Gildea2019-10-09 09:19:10 -0700
commit600bcde608479fc454e4794add84905d6337d3fa (patch)
treefc8b7167dc36390f6ce5872ce215ca12e76b3a67 /lisp
parent3d57c829af571465c261d9f865eeee5ed3cae985 (diff)
downloademacs-600bcde608479fc454e4794add84905d6337d3fa.tar.gz
emacs-600bcde608479fc454e4794add84905d6337d3fa.zip
time-stamp: revert recent change to "%04y"
* time-stamp.el (time-stamp-string-preprocess): Revert change to "%04y" format made 2 weeks ago by commit 0e56883878 (the previous commit to this file). Although undocumented, "%04y" was discovered to be in use in the wild (2016) and had not issued a warning that it would change. Add a warning that it will change. * time-stamp-tests.el (time-stamp-test-year-2digit): add test of "%04y"
Diffstat (limited to 'lisp')
-rw-r--r--lisp/time-stamp.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el
index 4fb28b2fd37..284dd48d4fc 100644
--- a/lisp/time-stamp.el
+++ b/lisp/time-stamp.el
@@ -545,7 +545,11 @@ and all `time-stamp-format' compatibility."
545 ((eq cur-char ?y) ;year 545 ((eq cur-char ?y) ;year
546 (if alt-form 546 (if alt-form
547 (string-to-number (time-stamp--format "%Y" time)) 547 (string-to-number (time-stamp--format "%Y" time))
548 (string-to-number (time-stamp--format "%y" time)))) 548 (if (or (string-equal field-width "")
549 (<= (string-to-number field-width) 2))
550 (string-to-number (time-stamp--format "%y" time))
551 (time-stamp-conv-warn (format "%%%sy" field-width) "%Y")
552 (string-to-number (time-stamp--format "%Y" time)))))
549 ((eq cur-char ?Y) ;4-digit year 553 ((eq cur-char ?Y) ;4-digit year
550 (string-to-number (time-stamp--format "%Y" time))) 554 (string-to-number (time-stamp--format "%Y" time)))
551 ((eq cur-char ?z) ;time zone lower case 555 ((eq cur-char ?z) ;time zone lower case
@@ -630,8 +634,7 @@ The new forms being recommended now will continue to work then.")
630 634
631(defun time-stamp-conv-warn (old-form new-form) 635(defun time-stamp-conv-warn (old-form new-form)
632 "Display a warning about a soon-to-be-obsolete format. 636 "Display a warning about a soon-to-be-obsolete format.
633Suggests replacing OLD-FORM with NEW-FORM. 637Suggests replacing OLD-FORM with NEW-FORM."
634In use before 2019 changes; will be used again after those changes settle."
635 (cond 638 (cond
636 (time-stamp-conversion-warn 639 (time-stamp-conversion-warn
637 (with-current-buffer (get-buffer-create "*Time-stamp-compatibility*") 640 (with-current-buffer (get-buffer-create "*Time-stamp-compatibility*")
@@ -640,7 +643,7 @@ In use before 2019 changes; will be used again after those changes settle."
640 (progn 643 (progn
641 (insert 644 (insert
642 "The formats recognized in time-stamp-format will change in a future release\n" 645 "The formats recognized in time-stamp-format will change in a future release\n"
643 "to be compatible with the new, expanded format-time-string function.\n\n" 646 "to be more compatible with the format-time-string function.\n\n"
644 "The following obsolescent time-stamp-format construct(s) were found:\n\n"))) 647 "The following obsolescent time-stamp-format construct(s) were found:\n\n")))
645 (insert "\"" old-form "\" -- use " new-form "\n")) 648 (insert "\"" old-form "\" -- use " new-form "\n"))
646 (display-buffer "*Time-stamp-compatibility*")))) 649 (display-buffer "*Time-stamp-compatibility*"))))