1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-05-28 08:02:40 -07:00

time-stamp: %F is "file name" not "pathname" + other doc

* lisp/time-stamp.el (time-stamp-format): doc 'file' instead of 'path'.
* test/lisp/time-stamp-tests.el (formatz, format-time-offset):
Clarify the difference and similarity between these two test helpers.
This commit is contained in:
Stephen Gildea 2021-11-09 20:09:22 -08:00
parent beaa7e14f3
commit 8d81ab374d
2 changed files with 8 additions and 7 deletions

View file

@ -65,7 +65,7 @@ with %, as follows.
Non-date items: Non-date items:
%% a literal percent character: `%' %% a literal percent character: `%'
%f file name without directory %F gives absolute pathname %f file name without directory %F absolute file name
%l login name %L full name of logged-in user %l login name %L full name of logged-in user
%q unqualified host name %Q fully-qualified host name %q unqualified host name %Q fully-qualified host name
%h mail host name %h mail host name
@ -661,7 +661,7 @@ and all `time-stamp-format' compatibility."
(if buffer-file-name (if buffer-file-name
(file-name-nondirectory buffer-file-name) (file-name-nondirectory buffer-file-name)
time-stamp-no-file)) time-stamp-no-file))
((eq cur-char ?F) ;buffer-file-name, full path ((eq cur-char ?F) ;buffer-file-name, absolute name
(or buffer-file-name (or buffer-file-name
time-stamp-no-file)) time-stamp-no-file))
((eq cur-char ?s) ;system name, legacy ((eq cur-char ?s) ;system name, legacy

View file

@ -704,9 +704,10 @@
;;;; Setup for tests of time offset formatting with %z ;;;; Setup for tests of time offset formatting with %z
(defun formatz (format zone) (defun formatz (format zone)
"Uses time FORMAT string to format the offset of ZONE, returning the result. "Uses FORMAT to format the offset of ZONE, returning the result.
FORMAT is \"%z\" or a variation. FORMAT must be time format \"%z\" or some variation thereof.
ZONE is as the ZONE argument of the `format-time-string' function." ZONE is as the ZONE argument of the `format-time-string' function.
This function is called by 99% of the `time-stamp' \"%z\" unit tests."
(with-time-stamp-test-env (with-time-stamp-test-env
(let ((time-stamp-time-zone zone)) (let ((time-stamp-time-zone zone))
;; Call your favorite time formatter here. ;; Call your favorite time formatter here.
@ -718,9 +719,9 @@ ZONE is as the ZONE argument of the `format-time-string' function."
(defun format-time-offset (format offset-secs) (defun format-time-offset (format offset-secs)
"Uses FORMAT to format the time zone represented by OFFSET-SECS. "Uses FORMAT to format the time zone represented by OFFSET-SECS.
FORMAT must be \"%z\", possibly with a flag and padding. FORMAT must be time format \"%z\" or some variation thereof.
This function is a wrapper around `time-stamp-formatz-from-parsed-options' This function is a wrapper around `time-stamp-formatz-from-parsed-options'
and is used for testing." and is called by some low-level `time-stamp' \"%z\" unit tests."
;; This wrapper adds a simple regexp-based parser that handles only ;; This wrapper adds a simple regexp-based parser that handles only
;; %z and variants. In normal use, time-stamp-formatz-from-parsed-options ;; %z and variants. In normal use, time-stamp-formatz-from-parsed-options
;; is called from a parser that handles all time string formats. ;; is called from a parser that handles all time string formats.