0
  • 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 date YYMMDD_ 2023-12-12 and 2. current time string Wed 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
0

1 Answer 1

1

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.

1
  • @jindam: did this work for you?
    – NickD
    Commented Dec 18, 2023 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.