diff options
author | Vincent Ambo <tazjin@google.com> | 2019-12-14T13·22+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2019-12-14T13·22+0000 |
commit | 1f204f2891038bfced0b799837764495d351f1a5 (patch) | |
tree | 4bad21bdea0d975678666dd97f25a08b7fcb24dd /tools/emacs/init | |
parent | c1ba41a62d3fedc11c18796ed4f28239a7f2f752 (diff) |
feat(emacs.d): Display modeline time in dottime r/140
See dotti.me for more information about dottime. <3 edef
Diffstat (limited to 'tools/emacs/init')
-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 () |