1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

; * lisp/time-stamp.el: Minor code changes

autoloads: quote function names with #'
(time-stamp-filtered-buffer-file-name): 'member' -> 'memq'
(time-stamp-conv-warn): don't call the formats "forms".
This commit is contained in:
Stephen Gildea 2025-11-23 18:11:18 -08:00
parent 11b68c6223
commit 435c3948a4

View file

@ -111,7 +111,7 @@ If your files might be edited by older versions of Emacs also, you should
limit yourself to the formats recommended by that older version." limit yourself to the formats recommended by that older version."
:type 'string :type 'string
:version "31.1") :version "31.1")
;;;###autoload(put 'time-stamp-format 'safe-local-variable 'stringp) ;;;###autoload(put 'time-stamp-format 'safe-local-variable #'stringp)
(defcustom time-stamp-active t (defcustom time-stamp-active t
@ -153,7 +153,7 @@ Its format is that of the ZONE argument of the `format-time-string' function."
(string :tag "Time zone abbreviation")) (string :tag "Time zone abbreviation"))
(integer :tag "Offset (seconds east of UTC)")) (integer :tag "Offset (seconds east of UTC)"))
:version "20.1") :version "20.1")
;;;###autoload(put 'time-stamp-time-zone 'safe-local-variable 'time-stamp-zone-type-p) ;;;###autoload(put 'time-stamp-time-zone 'safe-local-variable #'time-stamp-zone-type-p)
;;;###autoload ;;;###autoload
@ -191,7 +191,7 @@ These variables are best changed with file-local variables.
If you were to change `time-stamp-line-limit', `time-stamp-start', If you were to change `time-stamp-line-limit', `time-stamp-start',
`time-stamp-end', or `time-stamp-pattern' in your init file, you `time-stamp-end', or `time-stamp-pattern' in your init file, you
would be incompatible with other people's files.") would be incompatible with other people's files.")
;;;###autoload(put 'time-stamp-line-limit 'safe-local-variable 'integerp) ;;;###autoload(put 'time-stamp-line-limit 'safe-local-variable #'integerp)
(defvar time-stamp-start "Time-stamp:[ \t]+\\\\?[\"<]+" ;Do not change! (defvar time-stamp-start "Time-stamp:[ \t]+\\\\?[\"<]+" ;Do not change!
@ -205,7 +205,7 @@ These variables are best changed with file-local variables.
If you were to change `time-stamp-line-limit', `time-stamp-start', If you were to change `time-stamp-line-limit', `time-stamp-start',
`time-stamp-end', or `time-stamp-pattern' in your init file, you `time-stamp-end', or `time-stamp-pattern' in your init file, you
would be incompatible with other people's files.") would be incompatible with other people's files.")
;;;###autoload(put 'time-stamp-start 'safe-local-variable 'stringp) ;;;###autoload(put 'time-stamp-start 'safe-local-variable #'stringp)
(defvar time-stamp-end "\\\\?[\">]" ;Do not change! (defvar time-stamp-end "\\\\?[\">]" ;Do not change!
@ -228,7 +228,7 @@ These variables are best changed with file-local variables.
If you were to change `time-stamp-line-limit', `time-stamp-start', If you were to change `time-stamp-line-limit', `time-stamp-start',
`time-stamp-end', `time-stamp-pattern', or `time-stamp-inserts-lines' in `time-stamp-end', `time-stamp-pattern', or `time-stamp-inserts-lines' in
your init file, you would be incompatible with other people's files.") your init file, you would be incompatible with other people's files.")
;;;###autoload(put 'time-stamp-end 'safe-local-variable 'stringp) ;;;###autoload(put 'time-stamp-end 'safe-local-variable #'stringp)
(defvar time-stamp-inserts-lines nil ;Do not change! (defvar time-stamp-inserts-lines nil ;Do not change!
@ -244,7 +244,7 @@ for generating repeated time stamps.
These variables are best changed with file-local variables. These variables are best changed with file-local variables.
If you were to change `time-stamp-end' or `time-stamp-inserts-lines' in If you were to change `time-stamp-end' or `time-stamp-inserts-lines' in
your init file, you would be incompatible with other people's files.") your init file, you would be incompatible with other people's files.")
;;;###autoload(put 'time-stamp-inserts-lines 'safe-local-variable 'booleanp) ;;;###autoload(put 'time-stamp-inserts-lines 'safe-local-variable #'booleanp)
(defvar time-stamp-count 1 ;Do not change! (defvar time-stamp-count 1 ;Do not change!
@ -313,7 +313,7 @@ in-depth examples.
See also `time-stamp-count' and `time-stamp-inserts-lines'.") See also `time-stamp-count' and `time-stamp-inserts-lines'.")
;;;###autoload(put 'time-stamp-pattern 'safe-local-variable 'stringp) ;;;###autoload(put 'time-stamp-pattern 'safe-local-variable #'stringp)
@ -838,7 +838,7 @@ TYPE is :absolute for the full name or :nondirectory for base name only."
(let ((category (get-char-code-property chr 'general-category))) (let ((category (get-char-code-property chr 'general-category)))
(if (or (if (or
;; Letter, Mark, Number, Punctuation, or Symbol ;; Letter, Mark, Number, Punctuation, or Symbol
(member (aref (symbol-name category) 0) '(?L ?M ?N ?P ?S)) (memq (aref (symbol-name category) 0) '(?L ?M ?N ?P ?S))
;; spaces of various widths, but not ctrl chars like CR or LF ;; spaces of various widths, but not ctrl chars like CR or LF
(eq category 'Zs)) (eq category 'Zs))
chr chr
@ -857,14 +857,15 @@ You really need to update your files instead.
The new formats will work with old versions of Emacs. The new formats will work with old versions of Emacs.
New formats are being recommended now to allow `time-stamp-format' New formats are being recommended now to allow `time-stamp-format'
to change in the future to be compatible with `format-time-string'. to change in the future to be compatible with `format-time-string'.
The new forms being recommended now will continue to work then.") The new formats being recommended now will continue to work then.")
(defun time-stamp-conv-warn (old-form new-form &optional standard-form) (defun time-stamp-conv-warn (old-format new-format &optional standard-format)
"Display a warning about a soon-to-be-obsolete format. "Display a warning about a soon-to-be-obsolete format.
Suggests replacing OLD-FORM with NEW-FORM (same effect, but stable) Suggests replacing OLD-FORMAT with NEW-FORMAT (same effect, but stable)
or (if provided) STANDARD-FORM (the effect the user may have expected or (if provided) STANDARD-FORMAT (the effect the user may have expected
if they didn't read the documentation)." if they didn't read the documentation).
This is an internal function called by `time-stamp'."
(cond (cond
(time-stamp-conversion-warn (time-stamp-conversion-warn
(with-current-buffer (get-buffer-create "*Time-stamp-compatibility*") (with-current-buffer (get-buffer-create "*Time-stamp-compatibility*")
@ -877,15 +878,15 @@ if they didn't read the documentation)."
"The conversions recognized in `time-stamp-format' will change in a future\n" "The conversions recognized in `time-stamp-format' will change in a future\n"
"release to be more compatible with the function `format-time-string'.\n" "release to be more compatible with the function `format-time-string'.\n"
(cond (cond
(standard-form (standard-format
(concat (concat
"Conversions that are changing are ambiguous and should be replaced by\n" "Conversions that are changing are ambiguous and should be replaced by\n"
"stable conversions that make your intention clear.\n"))) "stable conversions that make your intention clear.\n")))
"\n" "\n"
"The following obsolescent `time-stamp-format' conversion(s) were found:\n\n"))))) "The following obsolescent `time-stamp-format' conversion(s) were found:\n\n")))))
(insert old-form " -- use " new-form) (insert old-format " -- use " new-format)
(if standard-form (if standard-format
(insert " or " standard-form)) (insert " or " standard-format))
(insert "\n") (insert "\n")
(help-make-xrefs)) (help-make-xrefs))
(display-buffer "*Time-stamp-compatibility*")))) (display-buffer "*Time-stamp-compatibility*"))))