]> code.delx.au - gnu-emacs/blobdiff - lisp/time-stamp.el
Update copyright year to 2016
[gnu-emacs] / lisp / time-stamp.el
index 7e4a3df875085dab0591b4e0a97ee77b6e0f5acb..46c993e1f5fbcbb0f437641f57f83624451608c0 100644 (file)
@@ -1,7 +1,7 @@
 ;;; time-stamp.el --- Maintain last change time stamps in files edited by Emacs
 
-;; Copyright (C) 1989, 1993, 1994, 1995, 1997, 2000, 2001, 2002, 2003,
-;;   2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1993-1995, 1997, 2000-2016 Free Software
+;; Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -29,7 +29,7 @@
 ;;     static char *ts = "sdmain.c Time-stamp: <2001-08-13 10:20:51 gildea>";
 ;; See the top of `time-stamp.el' for another example.
 
-;; To use time-stamping, add this line to your .emacs file:
+;; To use time-stamping, add this line to your init file:
 ;;     (add-hook 'before-save-hook 'time-stamp)
 ;; Now any time-stamp templates in your files will be updated automatically.
 
@@ -254,8 +254,8 @@ time-stamped file itself.")
 (defun time-stamp ()
   "Update the time stamp string(s) in the buffer.
 A template in a file can be automatically updated with a new time stamp
-every time you save the file.  Add this line to your .emacs file:
-    (add-hook 'before-save-hook 'time-stamp)
+every time you save the file.  Add this line to your init file:
+    (add-hook \\='before-save-hook \\='time-stamp)
 or customize `before-save-hook' through Custom.
 Normally the template must appear in the first 8 lines of a file and
 look like one of the following:
@@ -420,16 +420,8 @@ format the string."
   (or ts-format
       (setq ts-format time-stamp-format))
   (if (stringp ts-format)
-      (if (stringp time-stamp-time-zone)
-         (let ((ts-real-time-zone (getenv "TZ")))
-           (unwind-protect
-               (progn
-                 (set-time-zone-rule time-stamp-time-zone)
-                 (format-time-string
-                  (time-stamp-string-preprocess ts-format)))
-             (set-time-zone-rule ts-real-time-zone)))
-       (format-time-string
-        (time-stamp-string-preprocess ts-format)))
+      (format-time-string (time-stamp-string-preprocess ts-format)
+                          nil time-stamp-time-zone)
     ;; handle version 1 compatibility
     (cond ((or (eq time-stamp-old-format-warn 'error)
               (and (eq time-stamp-old-format-warn 'ask)
@@ -470,7 +462,7 @@ and all `time-stamp-format' compatibility."
        (result "")
        field-width
        field-result
-       alt-form change-case require-padding
+       alt-form change-case
        (paren-level 0))
     (while (< ind fmt-len)
       (setq cur-char (aref format ind))
@@ -480,7 +472,7 @@ and all `time-stamp-format' compatibility."
       (cond
        ((eq cur-char ?%)
        ;; eat any additional args to allow for future expansion
-       (setq alt-form nil change-case nil require-padding nil field-width "")
+       (setq alt-form nil change-case nil field-width "")
        (while (progn
                 (setq ind (1+ ind))
                 (setq cur-char (if (< ind fmt-len)
@@ -660,8 +652,7 @@ The new forms being recommended now will continue to work then.")
 Suggests replacing OLD-FORM with NEW-FORM."
   (cond
    (time-stamp-conversion-warn
-    (save-excursion
-      (set-buffer (get-buffer-create "*Time-stamp-compatibility*"))
+    (with-current-buffer (get-buffer-create "*Time-stamp-compatibility*")
       (goto-char (point-max))
       (if (bobp)
          (progn
@@ -686,7 +677,7 @@ otherwise the value of the function `system-name'."
 ;;; the rest of this file is for version 1 compatibility
 
 (defun time-stamp-fconcat (list sep)
-  "Similar to (mapconcat 'funcall LIST SEP) but LIST allows literals.
+  "Similar to (mapconcat \\='funcall LIST SEP) but LIST allows literals.
 If an element of LIST is a symbol, it is funcalled to get the string to use;
 the separator SEP is used between two strings obtained by funcalling a
 symbol.  Otherwise the element itself is inserted; no separator is used
@@ -705,74 +696,6 @@ around literals."
       (setq list (cdr list)))
     return-string))
 
-;;; Some functions used in time-stamp-format
-
-;;; These functions have been obsolete since 1995
-;;; and will be removed in Emacs 23.
-;;; Meanwhile, discourage other packages from using them.
-(dolist (function '(time-stamp-month-dd-yyyy time-stamp-dd/mm/yyyy
-                   time-stamp-mon-dd-yyyy   time-stamp-dd-mon-yy
-                   time-stamp-yy/mm/dd      time-stamp-yyyy/mm/dd
-                   time-stamp-yyyy-mm-dd    time-stamp-yymmdd
-                   time-stamp-hh:mm:ss      time-stamp-hhmm))
-  (make-obsolete function
-                "use `time-stamp-string' or `format-time-string' instead."
-                "20.1"))
-
-;;; pretty form, suitable for a title page
-
-(defun time-stamp-month-dd-yyyy ()
-  "Return the current date as a string in \"Month DD, YYYY\" form."
-  (format-time-string "%B %e, %Y"))
-
-(defun time-stamp-dd/mm/yyyy ()
-  "Return the current date as a string in \"DD/MM/YYYY\" form."
-  (format-time-string "%d/%m/%Y"))
-
-;;; same as __DATE__ in ANSI C
-
-(defun time-stamp-mon-dd-yyyy ()
-  "Return the current date as a string in \"Mon DD YYYY\" form.
-The first character of DD is space if the value is less than 10."
-  (format-time-string "%b %d %Y"))
-
-;;; RFC 822 date
-
-(defun time-stamp-dd-mon-yy ()
-  "Return the current date as a string in \"DD Mon YY\" form."
-  (format-time-string "%d %b %y"))
-
-;;; RCS 3 date
-
-(defun time-stamp-yy/mm/dd ()
-  "Return the current date as a string in \"YY/MM/DD\" form."
-  (format-time-string "%y/%m/%d"))
-
-;;; RCS 5 date
-
-(defun time-stamp-yyyy/mm/dd ()
-  "Return the current date as a string in \"YYYY/MM/DD\" form."
-  (format-time-string "%Y/%m/%d"))
-
-;;; ISO 8601 date
-
-(defun time-stamp-yyyy-mm-dd ()
-  "Return the current date as a string in \"YYYY-MM-DD\" form."
-  (format-time-string "%Y-%m-%d"))
-
-(defun time-stamp-yymmdd ()
-  "Return the current date as a string in \"YYMMDD\" form."
-  (format-time-string "%y%m%d"))
-
-(defun time-stamp-hh:mm:ss ()
-  "Return the current time as a string in \"HH:MM:SS\" form."
-  (format-time-string "%T"))
-
-(defun time-stamp-hhmm ()
-  "Return the current time as a string in \"HHMM\" form."
-  (format-time-string "%H%M"))
-
 (provide 'time-stamp)
 
-;; arch-tag: 8a12c5c3-25d6-4a71-adc5-24b0e025a1e7
 ;;; time-stamp.el ends here