]> code.delx.au - gnu-emacs/blobdiff - lisp/time-stamp.el
*** empty log message ***
[gnu-emacs] / lisp / time-stamp.el
index a3f0d66be3e0ed8e27c9ae2ead362b4cd1345727..0f3aeb068954b41728f27fdf045f082fe641f13a 100644 (file)
@@ -1,11 +1,11 @@
 ;;; time-stamp.el --- Maintain last change time stamps in files edited by Emacs
 
-;; Copyright 1989, 1993, 1994, 1995, 1997, 2000, 2001
-;;;    Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1993, 1994, 1995, 1997, 2000, 2001, 2002, 2003,
+;;   2004, 2005 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
-;; Maintainer's Time-stamp: <2003-02-01 09:26:25 gildea>
+;; Maintainer's Time-stamp: <2004-06-13 19:04:36 teirllm>
 ;; Maintainer: Stephen Gildea <gildea@stop.mail-abuse.org>
 ;; Keywords: tools
 
@@ -21,8 +21,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -32,7 +32,7 @@
 ;; See the top of `time-stamp.el' for another example.
 
 ;; To use time-stamping, add this line to your .emacs file:
-;;     (add-hook 'write-file-hooks 'time-stamp)
+;;     (add-hook 'before-save-hook 'time-stamp)
 ;; Now any time-stamp templates in your files will be updated automatically.
 
 ;; See the documentation for the functions `time-stamp'
@@ -242,7 +242,8 @@ of the time-stamped file itself.")
   "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 'write-file-hooks 'time-stamp)
+    (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:
       Time-stamp: <>
@@ -269,7 +270,7 @@ template."
          (string-match "\\`\\(\\(-?[0-9]+\\)/\\)?\\([^%]+\\)?\\(\\(%[-.,:@+_ #^()0-9]*[A-Za-z%][^%]*\\)*%[-.,:@+_ #^()0-9]*[A-Za-z%]\\)?\\([^%]+\\)?\\'" time-stamp-pattern)
          (and (match-beginning 2)
               (setq line-limit
-                    (string-to-int (match-string 2 time-stamp-pattern))))
+                    (string-to-number (match-string 2 time-stamp-pattern))))
          (and (match-beginning 3)
               (setq ts-start (match-string 3 time-stamp-pattern)))
          (and (match-beginning 4)
@@ -318,7 +319,6 @@ template."
       (setq start (time-stamp-once start search-limit ts-start ts-end
                                   ts-format format-lines end-lines))
       (setq ts-count (1- ts-count))))
-  ;; be sure to return nil so can be used on write-file-hooks
   nil)
 
 (defun time-stamp-once (start search-limit ts-start ts-end
@@ -558,9 +558,9 @@ and all `time-stamp-format' compatibility."
         ((eq cur-char ?y)              ;year
          (or alt-form (not (string-equal field-width ""))
              (time-stamp-conv-warn "%y" "%:y"))
-         (string-to-int (format-time-string "%Y" time)))
+         (string-to-number (format-time-string "%Y" time)))
         ((eq cur-char ?Y)              ;4-digit year, new style
-         (string-to-int (format-time-string "%Y" time)))
+         (string-to-number (format-time-string "%Y" time)))
         ((eq cur-char ?z)              ;time zone lower case
          (if change-case
              ""                        ;discourage %z variations
@@ -597,7 +597,7 @@ and all `time-stamp-format' compatibility."
          (let* ((initial-length (length padded-result))
                 (desired-length (if (string-equal field-width "")
                                     initial-length
-                                  (string-to-int field-width))))
+                                  (string-to-number field-width))))
            (if (> initial-length desired-length)
                ;; truncate strings on right, years on left
                (if (stringp field-result)
@@ -621,7 +621,7 @@ width specification or \"\".  TIME is the time to convert."
                               (format "%%:%c" format-char)))
     (if (and alt-form (not (string-equal field-width "")))
        ""                              ;discourage "%:2d" and the like
-      (string-to-int (format-time-string format-string time)))))
+      (string-to-number (format-time-string format-string time)))))
 
 (defvar time-stamp-conversion-warn t
   "Warn about soon-to-be-unsupported forms in `time-stamp-format'.
@@ -760,4 +760,5 @@ The first character of DD is space if the value is less than 10."
 
 (provide 'time-stamp)
 
+;;; arch-tag: 8a12c5c3-25d6-4a71-adc5-24b0e025a1e7
 ;;; time-stamp.el ends here