fix(dottime.el): Defer package-specific setup
This commit is contained in:
parent
a54cc040ad
commit
100f451b0a
2 changed files with 33 additions and 30 deletions
|
@ -60,13 +60,14 @@
|
||||||
(if (or (eq arg 0) (eq arg nil))
|
(if (or (eq arg 0) (eq arg nil))
|
||||||
(advice-remove 'display-time-update #'dottime--display-time-update-advice)
|
(advice-remove 'display-time-update #'dottime--display-time-update-advice)
|
||||||
(advice-add 'display-time-update :around #'dottime--display-time-update-advice))
|
(advice-add 'display-time-update :around #'dottime--display-time-update-advice))
|
||||||
(display-time-update))
|
(display-time-update)
|
||||||
|
|
||||||
;; Amend the time display in telega.el to use dottime.
|
;; Amend the time display in telega.el to use dottime.
|
||||||
;;
|
;;
|
||||||
;; This will never display offsets in the chat window, as those are
|
;; This will never display offsets in the chat window, as those are
|
||||||
;; always visible in the modeline anyways.
|
;; always visible in the modeline anyways.
|
||||||
(when (featurep 'telega)
|
(when (featurep 'telega)
|
||||||
|
(require 'telega)
|
||||||
(defun telega-ins--dottime-advice (orig timestamp)
|
(defun telega-ins--dottime-advice (orig timestamp)
|
||||||
(let* ((dtime (decode-time timestamp t))
|
(let* ((dtime (decode-time timestamp t))
|
||||||
(current-ts (time-to-seconds (current-time)))
|
(current-ts (time-to-seconds (current-time)))
|
||||||
|
@ -80,6 +81,7 @@
|
||||||
|
|
||||||
;; Amend the time display in notmuch to use dottime.
|
;; Amend the time display in notmuch to use dottime.
|
||||||
(when (featurep 'notmuch)
|
(when (featurep 'notmuch)
|
||||||
|
(require 'notmuch)
|
||||||
(defun notmuch-show--dottime-date-advice (orig header header-value)
|
(defun notmuch-show--dottime-date-advice (orig header header-value)
|
||||||
(if (equal "Date" header)
|
(if (equal "Date" header)
|
||||||
;; Unfortunately the header insertion functions do not have access
|
;; Unfortunately the header insertion functions do not have access
|
||||||
|
@ -94,6 +96,6 @@
|
||||||
|
|
||||||
(funcall orig header header-value)))
|
(funcall orig header header-value)))
|
||||||
|
|
||||||
(advice-add 'notmuch-show-insert-header :around #'notmuch-show--dottime-date-advice))
|
(advice-add 'notmuch-show-insert-header :around #'notmuch-show--dottime-date-advice)))
|
||||||
|
|
||||||
(provide 'dottime)
|
(provide 'dottime)
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
(use-package dash-functional)
|
(use-package dash-functional)
|
||||||
|
|
||||||
(use-package dottime
|
(use-package dottime
|
||||||
|
:demand
|
||||||
:after (notmuch telega)
|
:after (notmuch telega)
|
||||||
:config (dottime-display-mode t))
|
:config (dottime-display-mode t))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue