diff options
Diffstat (limited to 'tools/emacs-pkgs/dottime')
-rw-r--r-- | tools/emacs-pkgs/dottime/dottime.el | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/emacs-pkgs/dottime/dottime.el b/tools/emacs-pkgs/dottime/dottime.el index 79ad86e844d4..1e02ece8cffa 100644 --- a/tools/emacs-pkgs/dottime/dottime.el +++ b/tools/emacs-pkgs/dottime/dottime.el @@ -66,7 +66,7 @@ ;; ;; This will never display offsets in the chat window, as those are ;; always visible in the modeline anyways. -(when (-contains? features 'telega) +(when (featurep 'telega) (defun telega-ins--dottime-advice (orig timestamp) (let* ((dtime (decode-time timestamp t)) (current-ts (time-to-seconds (current-time))) @@ -78,4 +78,22 @@ (advice-add 'telega-ins--date :around #'telega-ins--dottime-advice)) +;; Amend the time display in notmuch to use dottime. +(when (featurep 'notmuch) + (defun notmuch-show--dottime-date-advice (orig header header-value) + (if (equal "Date" header) + ;; Unfortunately the header insertion functions do not have access + ;; to the message object, which means that the only information we + ;; have about the timestamp is its string rendering. + (-let* (((sec min hour day mon year dow dst tz) + (parse-time-string header-value))) + (insert header ": " + (dottime-format (encode-time sec min hour day mon year tz) + tz "%a, %Y-") + "\n")) + + (funcall orig header header-value))) + + (advice-add 'notmuch-show-insert-header :around #'notmuch-show--dottime-date-advice)) + (provide 'dottime) |