From 6ee061e2051af470ecd6d94ce028d48f9789a7e2 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 15 Dec 2019 22:14:31 +0000 Subject: refactor(emacs.d): Use dottime from my dottime package Instead of locally advicing format-time-string, use my dottime package. --- tools/emacs/config/init.el | 1 + tools/emacs/config/look-and-feel.el | 15 --------------- tools/emacs/default.nix | 5 +++-- 3 files changed, 4 insertions(+), 17 deletions(-) (limited to 'tools') diff --git a/tools/emacs/config/init.el b/tools/emacs/config/init.el index a27a17c6dd..4c7806f0e5 100644 --- a/tools/emacs/config/init.el +++ b/tools/emacs/config/init.el @@ -38,6 +38,7 @@ (use-package dash) (use-package dash-functional) +(use-package dottime :config (dottime-display-mode t)) (use-package gruber-darker-theme) (use-package ht) (use-package hydra) diff --git a/tools/emacs/config/look-and-feel.el b/tools/emacs/config/look-and-feel.el index 8f42133fb8..88cab18ed2 100644 --- a/tools/emacs/config/look-and-feel.el +++ b/tools/emacs/config/look-and-feel.el @@ -27,21 +27,6 @@ (font . ,font))) (set-frame-font font t t)) -;; 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 () "Renders the mode-line-misc-info string for display in the diff --git a/tools/emacs/default.nix b/tools/emacs/default.nix index 841b3016bb..7c494f4bc3 100644 --- a/tools/emacs/default.nix +++ b/tools/emacs/default.nix @@ -8,6 +8,7 @@ with third_party.emacsPackagesNg; with third_party.emacs; let + localPackages = pkgs.tools.emacs-pkgs; emacsWithPackages = (third_party.emacsPackagesNgGen third_party.emacs26).emacsWithPackages; tazjinsEmacs = (emacsWithPackages(epkgs: @@ -81,7 +82,7 @@ let ]) ++ # Custom packages - [ carp-mode ] + [ carp-mode localPackages.dottime ] )); in third_party.writeShellScriptBin "tazjins-emacs" '' exec ${tazjinsEmacs}/bin/emacs \ @@ -90,5 +91,5 @@ in third_party.writeShellScriptBin "tazjins-emacs" '' --no-site-lisp \ --no-init-file \ --directory ${./config} \ - --eval "(require 'init)" + --eval "(require 'init)" $@ '' -- cgit 1.4.1