feat(dottime.el): Use dottime in telega.el, too
This commit is contained in:
parent
b48797e4ce
commit
5fd7de921b
1 changed files with 16 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue