- i am trying to create change log for all files edited on emacs using
add-log-time-format
- however, as of now,
add-log-time-format
provides only 2 formats: 1. ISO8601 dateYYMMDD_ 2023-12-12
and 2. current time stringWed Dec 13 00:07:35 2023
- i would like to add time format of
YYYY-MM-DDThh:mmTZD
as per w3c Date and Time Formats
1 Answer
There are three choices when you customize add-log-time-format
(at least since 2015): the two you listed OR you can write your own function and customize add-log-time-format
to specify Other
with your own function as the value.
The function can be as simple as this:
(defun my/add-log-iso8601-time-string-with-extras (&optional time zone)
(format-time-string "%Y-%m-%dT%H:%M%:z" time zone))
which can be added to your init file. Then C-h v add-log-time-format
will bring up the doc string of the indicated variable. Click the customize
link, select the Other
radio button, type (or better yet, cut-and-paste) the name of the function in the text box (where, by default, it says ignore
), then Apply and save
. Then try to add a log entry. You should probably restart Emacs and try it again to make sure everything is set up correctly.