diff options
Diffstat (limited to 'tools/emacs-pkgs/dottime')
-rw-r--r-- | tools/emacs-pkgs/dottime/dottime.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/emacs-pkgs/dottime/dottime.el b/tools/emacs-pkgs/dottime/dottime.el index 7caeb2f2c440..b4445d3c0bdc 100644 --- a/tools/emacs-pkgs/dottime/dottime.el +++ b/tools/emacs-pkgs/dottime/dottime.el @@ -56,4 +56,20 @@ (advice-add 'display-time-update :around #'dottime--display-time-update-advice)) (display-time-update)) +;; Amend the time display in telega.el to use dottime. +;; +;; This will never display offsets in the chat window, as those are +;; always visible in the modeline anyways. +(when (-contains? features 'telega) + (defun telega-ins--dottime-advice (orig timestamp) + (let* ((dtime (decode-time timestamp t)) + (current-ts (time-to-seconds (current-time))) + (ctime (decode-time current-ts)) + (today00 (telega--time-at00 current-ts ctime))) + (if (> timestamp today00) + (telega-ins-fmt "%02d·%02d" (nth 2 dtime) (nth 1 dtime)) + (funcall orig timestamp)))) + + (advice-add 'telega-ins--date :around #'telega-ins--dottime-advice)) + (provide 'dottime) |