diff options
-rw-r--r-- | tools/emacs/init/look-and-feel.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/emacs/init/look-and-feel.el b/tools/emacs/init/look-and-feel.el index 3d480bd5f43e..9402e09e5620 100644 --- a/tools/emacs/init/look-and-feel.el +++ b/tools/emacs/init/look-and-feel.el @@ -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 () |