feat(emacs.d): Display modeline time in dottime

See dotti.me for more information about dottime.

<3 edef
This commit is contained in:
Vincent Ambo 2019-12-14 13:22:28 +00:00
parent c1ba41a62d
commit 1f204f2891

View file

@ -31,6 +31,20 @@
(when (equal "adho" (system-name))
(setq battery-mode-line-format " %b%p%%")
(display-battery-mode))
;; Display modeline time in dottime (see https://dotti.me)
;;
;; This is done in a way that initially seems more complicated than
;; one would like, but this is unfortunately required due to the way
;; `format-time-string' handles timezones.
(defun format-dottime-advice (orig _ &optional _ _)
(let* ((offset-sec (car (current-time-zone)))
(offset-hours (/ offset-sec 60 60))
(dottime (if (/= offset-hours 0)
(concat "%M-%Dt%H·%M" (format "%0+3d" offset-hours))
"%m-%dT%H·%M")))
(apply orig '("%m-%dT%H·%M" nil t))))
(advice-add 'format-time-string :around #'format-dottime-advice)
;; Configure telephone-line
(defun telephone-misc-if-last-window ()