;;; time-stamp.el --- Maintain last change time stamps in files edited by Emacs
-;; Copyright 1989, 1993, 1994, 1995, 1997, 2000
+;; Copyright 1989, 1993, 1994, 1995, 1997, 2000, 2001
;;; Free Software Foundation, Inc.
-;; Maintainer's Time-stamp: <2000-10-23 16:08:34 gildea>
-;; Maintainer: Stephen Gildea <gildea@alum.mit.edu>
+;; This file is part of GNU Emacs.
+
+;; Maintainer's Time-stamp: <2001-09-20 11:57:46 gildea>
+;; Maintainer: Stephen Gildea <gildea@stop.mail-abuse.org>
;; Keywords: tools
-;; This file is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
-;; This file is distributed in the hope that it will be useful,
+;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
The value may be a string or a list. Lists are supported only for
backward compatibility; see variable `time-stamp-old-format-warn'.
-A string is used verbatim except for character sequences beginning with %:
+A string is used verbatim except for character sequences beginning
+with %, as follows. The values of non-numeric formatted items depend
+on the locale setting recorded in `system-time-locale' and
+`locale-coding-system'. The examples here are for the default
+\(`C') locale.
%:a weekday name: `Monday'. %#A gives uppercase: `MONDAY'
%3a abbreviated weekday: `Mon'. %3A gives uppercase: `MON'
If `error', the format is not used. If `ask', the user is queried about
using the time-stamp-format. If `warn', a warning is displayed.
If nil, no notification is given."
- :type '(choice (const :tag "No notification" nil)
- (const :tag "Don't use the format" error)
- (const ask) (const warn))
+ :type '(choice (const :tag "Don't use the format" error)
+ (const ask)
+ (const warn)
+ (const :tag "No notification" nil))
:group 'time-stamp)
(defcustom time-stamp-time-zone nil
(defun time-stamp-string (&optional ts-format)
"Generate the new string to be inserted by \\[time-stamp].
-Optionally use FORMAT."
+Optionally use format TS-FORMAT instead of `time-stamp-format' to
+format the string."
(or ts-format
(setq ts-format time-stamp-format))
(if (stringp ts-format)
;;; The : modifier is a temporary conversion feature used to resolve
;;; ambiguous formats--formats that are changing (over time) incompatibly.
(defun time-stamp-string-preprocess (format &optional time)
- ;; Use a FORMAT to format date, time, file, and user information.
- ;; Optional second argument TIME is only for testing.
- ;; Implements non-time extensions to format-time-string
- ;; and all time-stamp-format compatibility.
+ "Use a FORMAT to format date, time, file, and user information.
+Optional second argument TIME is only for testing.
+Implements non-time extensions to `format-time-string'
+and all time-stamp-format compatibility."
(let ((fmt-len (length format))
(ind 0)
cur-char
?\0))
(or (eq ?. cur-char)
(eq ?, cur-char) (eq ?: cur-char) (eq ?@ cur-char)
- (eq ?- cur-char) (eq ?+ cur-char) (eq ?_ cur-char)
+ (eq ?- cur-char) (eq ?+ cur-char) (eq ?_ cur-char)
(eq ?\ cur-char) (eq ?# cur-char) (eq ?^ cur-char)
(and (eq ?\( cur-char)
(not (eq prev-char ?\\))
"%%")
((eq cur-char ?a) ;day of week
(if change-case
- (format-time-string "%#A" time)
+ (format-time-string "%#a" time)
(or alt-form (not (string-equal field-width ""))
(time-stamp-conv-warn "%a" "%:a"))
(if (and alt-form (not (string-equal field-width "")))
(format-time-string "%#A" time)))
((eq cur-char ?b) ;month name
(if change-case
- (format-time-string "%#B" time)
+ (format-time-string "%#b" time)
(or alt-form (not (string-equal field-width ""))
(time-stamp-conv-warn "%b" "%:b"))
(if (and alt-form (not (string-equal field-width "")))
result))
(defun time-stamp-do-number (format-char alt-form field-width time)
- ;; Handle a compatible FORMAT-CHAR where only
- ;; the default width/padding will change.
- ;; ALT-FORM is whether `#' specified. FIELD-WIDTH is the string
- ;; width specification or "". TIME is the time to convert.
+ "Handle compatible FORMAT-CHAR where only default width/padding will change.
+ALT-FORM is whether `#' specified. FIELD-WIDTH is the string
+width specification or \"\". TIME is the time to convert."
(let ((format-string (concat "%" (char-to-string format-char))))
(and (not alt-form) (string-equal field-width "")
(time-stamp-conv-warn format-string
(defun time-stamp-conv-warn (old-form new-form)
- ;; Display a warning about a soon-to-be-obsolete format.
+ "Display a warning about a soon-to-be-obsolete format."
(cond
(time-stamp-conversion-warn
(save-excursion
"Return the current time as a string in \"HH:MM:SS\" form."
(format-time-string "%T"))
+(defun time-stamp-hhmmss ()
+ "Return the current time as a string in \"HHMMSS\" form."
+ (format-time-string "%H%M%S"))
+
(defun time-stamp-hhmm ()
"Return the current time as a string in \"HHMM\" form."
(format-time-string "%H%M"))