1 ;;; time-stamp.el --- Maintain last change time stamps in files edited by Emacs
3 ;; Copyright (C) 1989, 1993-1995, 1997, 2000-2016 Free Software
6 ;; This file is part of GNU Emacs.
8 ;; Maintainer's Time-stamp: <2006-04-12 20:30:56 rms>
9 ;; Maintainer: Stephen Gildea <gildea@stop.mail-abuse.org>
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 ;; A template in a file can be updated with a new time stamp when
28 ;; you save the file. For example:
29 ;; static char *ts = "sdmain.c Time-stamp: <2001-08-13 10:20:51 gildea>";
30 ;; See the top of `time-stamp.el' for another example.
32 ;; To use time-stamping, add this line to your init file:
33 ;; (add-hook 'before-save-hook 'time-stamp)
34 ;; Now any time-stamp templates in your files will be updated automatically.
36 ;; See the documentation for the functions `time-stamp'
37 ;; and `time-stamp-toggle-active' for details.
41 (defgroup time-stamp nil
42 "Maintain last change time stamps in files edited by Emacs."
46 (defcustom time-stamp-format
"%:y-%02m-%02d %02H:%02M:%02S %u"
47 "Format of the string inserted by \\[time-stamp].
48 The value may be a string or a list. Lists are supported only for
49 backward compatibility; see variable `time-stamp-old-format-warn'.
51 A string is used verbatim except for character sequences beginning
52 with %, as follows. The values of non-numeric formatted items depend
53 on the locale setting recorded in `system-time-locale' and
54 `locale-coding-system'. The examples here are for the default
57 %:a weekday name: `Monday'. %#A gives uppercase: `MONDAY'
58 %3a abbreviated weekday: `Mon'. %3A gives uppercase: `MON'
59 %:b month name: `January'. %#B gives uppercase: `JANUARY'
60 %3b abbreviated month: `Jan'. %3B gives uppercase: `JAN'
62 %02H 24-hour clock hour
63 %02I 12-hour clock hour
66 %#p `am' or `pm'. %P gives uppercase: `AM' or `PM'
68 %w day number of week, Sunday is 0
69 %02y 2-digit year: `03' %:y 4-digit year: `2003'
70 %z time zone name: `est'. %Z gives uppercase: `EST'
73 %% a literal percent character: `%'
74 %f file name without directory %F gives absolute pathname
76 %u user's login name %U user's full name
79 Decimal digits between the % and the type character specify the
80 field width. Strings are truncated on the right; years on the left.
81 A leading zero in the field width zero-fills a number.
83 For example, to get the format used by the `date' command,
84 use \"%3a %3b %2d %02H:%02M:%02S %Z %:y\".
86 In the future these formats will be aligned more with `format-time-string'.
87 Because of this transition, the default padding for numeric formats will
88 change in a future version. Therefore either a padding width should be
89 specified, or the : modifier should be used to explicitly request the
94 ;;;###autoload(put 'time-stamp-format 'safe-local-variable 'stringp)
96 (defcustom time-stamp-active t
97 "Non-nil to enable time-stamping of buffers by \\[time-stamp].
98 Can be toggled by \\[time-stamp-toggle-active].
99 See also the variable `time-stamp-warn-inactive'."
103 (defcustom time-stamp-warn-inactive t
104 "Have \\[time-stamp] warn if a buffer did not get time-stamped.
105 If non-nil, a warning is displayed if `time-stamp-active' has
106 deactivated time stamping and the buffer contains a template that
107 otherwise would have been updated."
112 (defcustom time-stamp-old-format-warn
'ask
113 "Action if `time-stamp-format' is an old-style list.
114 If `error', the format is not used. If `ask', the user is queried about
115 using the time-stamp-format. If `warn', a warning is displayed.
116 If nil, no notification is given."
117 :type
'(choice (const :tag
"Don't use the format" error
)
120 (const :tag
"No notification" nil
))
123 (defcustom time-stamp-time-zone nil
124 "The time zone to be used by \\[time-stamp].
125 Its format is that of the ZONE argument of the `format-time-string' function,"
126 :type
'(choice (const :tag
"Emacs local time" nil
)
127 (const :tag
"Universal Time" t
)
128 (const :tag
"system wall clock time" wall
)
129 (string :tag
"TZ environment variable value"))
132 ;;;###autoload(put 'time-stamp-time-zone 'safe-local-variable 'string-or-null-p)
134 ;;; Do not change time-stamp-line-limit, time-stamp-start,
135 ;;; time-stamp-end, time-stamp-pattern, time-stamp-inserts-lines,
136 ;;; or time-stamp-count in your .emacs or you will be incompatible
137 ;;; with other people's files! If you must change them, do so only
138 ;;; in the local variables section of the file itself.
141 (defvar time-stamp-line-limit
8 ;Do not change!
142 "Lines of a file searched; positive counts from start, negative from end.
143 The patterns `time-stamp-start' and `time-stamp-end' must be found in
144 the first (last) `time-stamp-line-limit' lines of the file for the
145 file to be time-stamped by \\[time-stamp]. A value of 0 searches the
146 entire buffer (use with care).
148 This value can also be set with the variable `time-stamp-pattern'.
150 Do not change `time-stamp-line-limit', `time-stamp-start',
151 `time-stamp-end', or `time-stamp-pattern' for yourself or you will be
152 incompatible with other people's files! If you must change them for some
153 application, do so in the local variables section of the time-stamped file
155 ;;;###autoload(put 'time-stamp-line-limit 'safe-local-variable 'integerp)
157 (defvar time-stamp-start
"Time-stamp:[ \t]+\\\\?[\"<]+" ;Do not change!
158 "Regexp after which the time stamp is written by \\[time-stamp].
159 See also the variables `time-stamp-end' and `time-stamp-line-limit'.
161 This value can also be set with the variable `time-stamp-pattern'.
163 Do not change `time-stamp-line-limit', `time-stamp-start',
164 `time-stamp-end', or `time-stamp-pattern' for yourself or you will be
165 incompatible with other people's files! If you must change them for some
166 application, do so in the local variables section of the time-stamped file
168 ;;;###autoload(put 'time-stamp-start 'safe-local-variable 'stringp)
170 (defvar time-stamp-end
"\\\\?[\">]" ;Do not change!
171 "Regexp marking the text after the time stamp.
172 \\[time-stamp] deletes the text between the first match of `time-stamp-start'
173 and the following match of `time-stamp-end', then writes the
174 time stamp specified by `time-stamp-format' between them.
176 This value can also be set with the variable `time-stamp-pattern'.
178 The end text normally starts on the same line as the start text ends,
179 but if there are any newlines in `time-stamp-format', the same number
180 of newlines must separate the start and end. \\[time-stamp] tries
181 to not change the number of lines in the buffer. `time-stamp-inserts-lines'
182 controls this behavior.
184 Do not change `time-stamp-start', `time-stamp-end', `time-stamp-pattern',
185 or `time-stamp-inserts-lines' for yourself or you will be incompatible
186 with other people's files! If you must change them for some application,
187 do so in the local variables section of the time-stamped file itself.")
188 ;;;###autoload(put 'time-stamp-end 'safe-local-variable 'stringp)
191 (defvar time-stamp-inserts-lines nil
;Do not change!
192 "Whether \\[time-stamp] can change the number of lines in a file.
193 If nil, \\[time-stamp] skips as many lines as there are newlines in
194 `time-stamp-format' before looking for the `time-stamp-end' pattern,
195 thus it tries not to change the number of lines in the buffer.
196 If non-nil, \\[time-stamp] starts looking for the end pattern
197 immediately after the start pattern. This behavior can cause
198 unexpected changes in the buffer if used carelessly, but it is useful
199 for generating repeated time stamps.
201 Do not change `time-stamp-end' or `time-stamp-inserts-lines' for
202 yourself or you will be incompatible with other people's files!
203 If you must change them for some application, do so in the local
204 variables section of the time-stamped file itself.")
205 ;;;###autoload(put 'time-stamp-inserts-lines 'safe-local-variable 'symbolp)
208 (defvar time-stamp-count
1 ;Do not change!
209 "How many templates \\[time-stamp] will look for in a buffer.
210 The same time stamp will be written in each case.
212 Do not change `time-stamp-count' for yourself or you will be
213 incompatible with other people's files! If you must change it for
214 some application, do so in the local variables section of the
215 time-stamped file itself.")
216 ;;;###autoload(put 'time-stamp-count 'safe-local-variable 'integerp)
219 (defvar time-stamp-pattern nil
;Do not change!
220 "Convenience variable setting all `time-stamp' location and format values.
221 This string has four parts, each of which is optional.
222 These four parts set `time-stamp-line-limit', `time-stamp-start',
223 `time-stamp-format', and `time-stamp-end'. See the documentation
224 for each of these variables for details.
226 The first part is a number followed by a slash; the number sets the number
227 of lines at the beginning (negative counts from end) of the file searched
228 for the time stamp. The number and the slash may be omitted to use the
231 The second part is a regexp identifying the pattern preceding the time stamp.
232 This part may be omitted to use the normal pattern.
234 The third part specifies the format of the time stamp inserted. See
235 the documentation for `time-stamp-format' for details. Specify this
236 part as \"%%\" to use the normal format.
238 The fourth part is a regexp identifying the pattern following the time stamp.
239 This part may be omitted to use the normal pattern.
243 \"-9/^Last modified: %%$\"
244 \"@set Time-stamp: %:b %:d, %:y$\"
245 \"newcommand{\\\\\\\\timestamp}{%%}\"
247 Do not change `time-stamp-pattern' `time-stamp-line-limit',
248 `time-stamp-start', or `time-stamp-end' for yourself or you will be
249 incompatible with other people's files! If you must change them for
250 some application, do so only in the local variables section of the
251 time-stamped file itself.")
252 ;;;###autoload(put 'time-stamp-pattern 'safe-local-variable 'stringp)
258 "Update the time stamp string(s) in the buffer.
259 A template in a file can be automatically updated with a new time stamp
260 every time you save the file. Add this line to your init file:
261 (add-hook \\='before-save-hook \\='time-stamp)
262 or customize `before-save-hook' through Custom.
263 Normally the template must appear in the first 8 lines of a file and
264 look like one of the following:
267 The time stamp is written between the brackets or quotes:
268 Time-stamp: <2001-02-18 10:20:51 gildea>
269 The time stamp is updated only if the variable `time-stamp-active' is non-nil.
270 The format of the time stamp is set by the variable `time-stamp-pattern' or
271 `time-stamp-format'. The variables `time-stamp-pattern',
272 `time-stamp-line-limit', `time-stamp-start', `time-stamp-end',
273 `time-stamp-count', and `time-stamp-inserts-lines' control finding
276 (let ((line-limit time-stamp-line-limit
)
277 (ts-start time-stamp-start
)
278 (ts-format time-stamp-format
)
279 (ts-end time-stamp-end
)
280 (ts-count time-stamp-count
)
285 (if (stringp time-stamp-pattern
)
287 (string-match "\\`\\(\\(-?[0-9]+\\)/\\)?\\([^%]+\\)?\\(\\(%[-.,:@+_ #^()0-9]*[A-Za-z%][^%]*\\)*%[-.,:@+_ #^()0-9]*[A-Za-z%]\\)?\\([^%]+\\)?\\'" time-stamp-pattern
)
288 (and (match-beginning 2)
290 (string-to-number (match-string 2 time-stamp-pattern
))))
291 (and (match-beginning 3)
292 (setq ts-start
(match-string 3 time-stamp-pattern
)))
293 (and (match-beginning 4)
294 (not (string-equal (match-string 4 time-stamp-pattern
) "%%"))
295 (setq ts-format
(match-string 4 time-stamp-pattern
)))
296 (and (match-beginning 6)
297 (setq ts-end
(match-string 6 time-stamp-pattern
)))))
298 (cond ((not (integerp line-limit
))
300 (message "time-stamp-line-limit is not an integer")
302 (cond ((not (integerp ts-count
))
304 (message "time-stamp-count is not an integer")
307 ;; We need to call time-stamp-once at least once
308 ;; to output any warnings about time-stamp not being active.
310 ;; Figure out what lines the end should be on.
311 (if (stringp ts-format
)
313 (while (string-match "\n" ts-format nl-start
)
314 (setq format-lines
(1+ format-lines
) nl-start
(match-end 0)))))
316 (while (string-match "\n" ts-end nl-start
)
317 (setq end-lines
(1+ end-lines
) nl-start
(match-end 0))))
318 ;; Find overall what lines to look at
322 (cond ((> line-limit
0)
323 (goto-char (setq start
(point-min)))
324 (forward-line line-limit
)
325 (setq search-limit
(point)))
327 (goto-char (setq search-limit
(point-max)))
328 (forward-line line-limit
)
329 (setq start
(point)))
330 (t ;0 => no limit (use with care!)
331 (setq start
(point-min))
332 (setq search-limit
(point-max))))))
334 (< start search-limit
)
336 (setq start
(time-stamp-once start search-limit ts-start ts-end
337 ts-format format-lines end-lines
))
338 (setq ts-count
(1- ts-count
))))
341 (defun time-stamp-once (start search-limit ts-start ts-end
342 ts-format format-lines end-lines
)
343 "Update one time stamp. Internal routine called by \\[time-stamp].
344 Returns the end point, which is where `time-stamp' begins the next search."
345 (let ((case-fold-search nil
)
352 ;; Find the location of the time stamp.
353 (while (and (< (goto-char start
) search-limit
)
355 (re-search-forward ts-start search-limit
'move
))
357 (if (not time-stamp-inserts-lines
)
358 (forward-line format-lines
))
359 (setq end-search-start
(max start
(point)))
360 (if (= (forward-line end-lines
) 0)
362 (and (bolp) (backward-char))
363 (let ((line-end (min (point) search-limit
)))
364 (if (>= line-end end-search-start
)
366 (goto-char end-search-start
)
367 (if (re-search-forward ts-end line-end t
)
369 (setq end
(match-beginning 0))
370 (setq end-length
(- (match-end 0) end
))))))))))))
373 ;; do all warnings outside save-excursion
375 ((not time-stamp-active
)
376 (if time-stamp-warn-inactive
377 ;; don't signal an error in a write-file-hook
379 (message "Warning: time-stamp-active is off; did not time-stamp buffer.")
381 ((not (and (stringp ts-start
)
383 (message "time-stamp-start or time-stamp-end is not a string")
386 (let ((new-time-stamp (time-stamp-string ts-format
)))
387 (if (and (stringp new-time-stamp
)
388 (not (string-equal (buffer-substring start end
)
393 (delete-region start end
)
395 (insert-and-inherit new-time-stamp
)
397 ;; remove any tabs used to format time stamp
398 (if (search-backward "\t" start t
)
401 (setq end
(point))))))))))))
402 ;; return the location after this time stamp, if there was one
404 (+ end end-length
))))
408 (defun time-stamp-toggle-active (&optional arg
)
409 "Toggle `time-stamp-active', setting whether \\[time-stamp] updates a buffer.
410 With ARG, turn time stamping on if and only if arg is positive."
412 (setq time-stamp-active
414 (not time-stamp-active
)
415 (> (prefix-numeric-value arg
) 0)))
416 (message "time-stamp is now %s." (if time-stamp-active
"active" "off")))
418 (defun time-stamp--format (format time
)
419 (format-time-string format time time-stamp-time-zone
))
421 (defun time-stamp-string (&optional ts-format
)
422 "Generate the new string to be inserted by \\[time-stamp].
423 Optionally use format TS-FORMAT instead of `time-stamp-format' to
426 (setq ts-format time-stamp-format
))
427 (if (stringp ts-format
)
428 (time-stamp--format (time-stamp-string-preprocess ts-format
) nil
)
429 ;; handle version 1 compatibility
430 (cond ((or (eq time-stamp-old-format-warn
'error
)
431 (and (eq time-stamp-old-format-warn
'ask
)
432 (not (y-or-n-p "Use non-string time-stamp-format? "))))
433 (message "Warning: no time-stamp: time-stamp-format not a string")
437 (cond ((eq time-stamp-old-format-warn
'warn
)
438 (message "Obsolescent time-stamp-format type; should be string")
440 (time-stamp-fconcat ts-format
" ")))))
442 (defconst time-stamp-no-file
"(no file)"
443 "String to use when the buffer is not associated with a file.")
445 ;;; time-stamp is transitioning to using the new, expanded capabilities
446 ;;; of format-time-string. During the process, this function implements
447 ;;; intermediate, compatible formats and complains about old, soon to
448 ;;; be unsupported, formats. This function will get a lot (a LOT) shorter
449 ;;; when the transition is complete and we can just pass most things
450 ;;; straight through to format-time-string.
451 ;;; At all times, all the formats recommended in the doc string
452 ;;; of time-stamp-format will work not only in the current version of
453 ;;; Emacs, but in all versions that have been released within the past
455 ;;; The : modifier is a temporary conversion feature used to resolve
456 ;;; ambiguous formats--formats that are changing (over time) incompatibly.
457 (defun time-stamp-string-preprocess (format &optional time
)
458 "Use a FORMAT to format date, time, file, and user information.
459 Optional second argument TIME is only for testing.
460 Implements non-time extensions to `format-time-string'
461 and all `time-stamp-format' compatibility."
462 (let ((fmt-len (length format
))
471 (while (< ind fmt-len
)
472 (setq cur-char
(aref format ind
))
478 ;; eat any additional args to allow for future expansion
479 (setq alt-form nil change-case nil field-width
"")
482 (setq cur-char
(if (< ind fmt-len
)
486 (eq ?
, cur-char
) (eq ?
: cur-char
) (eq ?
@ cur-char
)
487 (eq ?- cur-char
) (eq ?
+ cur-char
) (eq ?_ cur-char
)
488 (eq ?\s cur-char
) (eq ?
# cur-char
) (eq ?^ cur-char
)
489 (and (eq ?\
( cur-char
)
490 (not (eq prev-char ?
\\))
491 (setq paren-level
(1+ paren-level
)))
492 (if (and (eq ?\
) cur-char
)
493 (not (eq prev-char ?
\\))
495 (setq paren-level
(1- paren-level
))
496 (and (> paren-level
0)
498 (if (and (<= ?
0 cur-char
) (>= ?
9 cur-char
))
500 (let ((field-index ind
))
503 (setq cur-char
(if (< ind fmt-len
)
506 (and (<= ?
0 cur-char
) (>= ?
9 cur-char
))))
507 (setq field-width
(substring format field-index ind
))
510 (setq prev-char cur-char
)
511 ;; some characters we actually use
512 (cond ((eq cur-char ?
:)
515 (setq change-case t
))))
520 ((eq cur-char ?a
) ;day of week
522 (time-stamp--format "%#a" time
)
523 (or alt-form
(not (string-equal field-width
""))
524 (time-stamp-conv-warn "%a" "%:a"))
525 (if (and alt-form
(not (string-equal field-width
"")))
526 "" ;discourage "%:3a"
527 (time-stamp--format "%A" time
))))
530 (time-stamp--format "%A" time
)
531 (or change-case
(not (string-equal field-width
""))
532 (time-stamp-conv-warn "%A" "%#A"))
533 (time-stamp--format "%#A" time
)))
534 ((eq cur-char ?b
) ;month name
536 (time-stamp--format "%#b" time
)
537 (or alt-form
(not (string-equal field-width
""))
538 (time-stamp-conv-warn "%b" "%:b"))
539 (if (and alt-form
(not (string-equal field-width
"")))
540 "" ;discourage "%:3b"
541 (time-stamp--format "%B" time
))))
544 (time-stamp--format "%B" time
)
545 (or change-case
(not (string-equal field-width
""))
546 (time-stamp-conv-warn "%B" "%#B"))
547 (time-stamp--format "%#B" time
)))
548 ((eq cur-char ?d
) ;day of month, 1-31
549 (time-stamp-do-number cur-char alt-form field-width time
))
550 ((eq cur-char ?H
) ;hour, 0-23
551 (time-stamp-do-number cur-char alt-form field-width time
))
552 ((eq cur-char ?I
) ;hour, 1-12
553 (time-stamp-do-number cur-char alt-form field-width time
))
554 ((eq cur-char ?m
) ;month number, 1-12
555 (time-stamp-do-number cur-char alt-form field-width time
))
556 ((eq cur-char ?M
) ;minute, 0-59
557 (time-stamp-do-number cur-char alt-form field-width time
))
558 ((eq cur-char ?p
) ;am or pm
560 (time-stamp-conv-warn "%p" "%#p"))
561 (time-stamp--format "%#p" time
))
562 ((eq cur-char ?P
) ;AM or PM
563 (time-stamp--format "%p" time
))
564 ((eq cur-char ?S
) ;seconds, 00-60
565 (time-stamp-do-number cur-char alt-form field-width time
))
566 ((eq cur-char ?w
) ;weekday number, Sunday is 0
567 (time-stamp--format "%w" time
))
568 ((eq cur-char ?y
) ;year
569 (or alt-form
(not (string-equal field-width
""))
570 (time-stamp-conv-warn "%y" "%:y"))
571 (string-to-number (time-stamp--format "%Y" time
)))
572 ((eq cur-char ?Y
) ;4-digit year, new style
573 (string-to-number (time-stamp--format "%Y" time
)))
574 ((eq cur-char ?z
) ;time zone lower case
576 "" ;discourage %z variations
577 (time-stamp--format "%#Z" time
)))
580 (time-stamp--format "%#Z" time
)
581 (time-stamp--format "%Z" time
)))
582 ((eq cur-char ?f
) ;buffer-file-name, base name only
584 (file-name-nondirectory buffer-file-name
)
586 ((eq cur-char ?F
) ;buffer-file-name, full path
589 ((eq cur-char ?s
) ;system name
591 ((eq cur-char ?u
) ;user name
593 ((eq cur-char ?U
) ;user full name
595 ((eq cur-char ?l
) ;logname (undocumented user name alt)
597 ((eq cur-char ?L
) ;(undocumented alt user full name)
599 ((eq cur-char ?h
) ;mail host name
600 (time-stamp-mail-host-name))
601 ((eq cur-char ?q
) ;(undocumented unqual hostname)
602 (let ((qualname (system-name)))
603 (if (string-match "\\." qualname
)
604 (substring qualname
0 (match-beginning 0))
606 ((eq cur-char ?Q
) ;(undocumented fully-qualified host)
610 (format (format "%%%s%c"
612 (if (numberp field-result
) ?d ?s
))
613 (or field-result
""))))
614 (let* ((initial-length (length padded-result
))
615 (desired-length (if (string-equal field-width
"")
617 (string-to-number field-width
))))
618 (if (> initial-length desired-length
)
619 ;; truncate strings on right, years on left
620 (if (stringp field-result
)
621 (substring padded-result
0 desired-length
)
623 (substring padded-result
(- desired-length
))
624 padded-result
)) ;non-year numbers don't truncate
627 (char-to-string cur-char
)))))
631 (defun time-stamp-do-number (format-char alt-form field-width time
)
632 "Handle compatible FORMAT-CHAR where only default width/padding will change.
633 ALT-FORM is whether `#' specified. FIELD-WIDTH is the string
634 width specification or \"\". TIME is the time to convert."
635 (let ((format-string (concat "%" (char-to-string format-char
))))
636 (and (not alt-form
) (string-equal field-width
"")
637 (time-stamp-conv-warn format-string
638 (format "%%:%c" format-char
)))
639 (if (and alt-form
(not (string-equal field-width
"")))
640 "" ;discourage "%:2d" and the like
641 (string-to-number (time-stamp--format format-string time
)))))
643 (defvar time-stamp-conversion-warn t
644 "Warn about soon-to-be-unsupported forms in `time-stamp-format'.
645 If nil, these warnings are disabled, which would be a bad idea!
646 You really need to update your files instead.
648 The new formats will work with old versions of Emacs.
649 New formats are being recommended now to allow `time-stamp-format'
650 to change in the future to be compatible with `format-time-string'.
651 The new forms being recommended now will continue to work then.")
654 (defun time-stamp-conv-warn (old-form new-form
)
655 "Display a warning about a soon-to-be-obsolete format.
656 Suggests replacing OLD-FORM with NEW-FORM."
658 (time-stamp-conversion-warn
659 (with-current-buffer (get-buffer-create "*Time-stamp-compatibility*")
660 (goto-char (point-max))
664 "The formats recognized in time-stamp-format will change in a future release\n"
665 "to be compatible with the new, expanded format-time-string function.\n\n"
666 "The following obsolescent time-stamp-format construct(s) were found:\n\n")))
667 (insert "\"" old-form
"\" -- use " new-form
"\n"))
668 (display-buffer "*Time-stamp-compatibility*"))))
672 (defun time-stamp-mail-host-name ()
673 "Return the name of the host where the user receives mail.
674 This is the value of `mail-host-address' if bound and a string,
675 otherwise the value of the function `system-name'."
676 (or (and (boundp 'mail-host-address
)
677 (stringp mail-host-address
)
681 ;;; the rest of this file is for version 1 compatibility
683 (defun time-stamp-fconcat (list sep
)
684 "Similar to (mapconcat \\='funcall LIST SEP) but LIST allows literals.
685 If an element of LIST is a symbol, it is funcalled to get the string to use;
686 the separator SEP is used between two strings obtained by funcalling a
687 symbol. Otherwise the element itself is inserted; no separator is used
689 (let ((return-string "")
692 (cond ((symbolp (car list
))
694 (setq return-string
(concat return-string sep
)))
695 (setq return-string
(concat return-string
(funcall (car list
))))
696 (setq insert-sep-p t
))
698 (setq return-string
(concat return-string
(car list
)))
699 (setq insert-sep-p nil
)))
700 (setq list
(cdr list
)))
703 (provide 'time-stamp
)
705 ;;; time-stamp.el ends here