aboutsummaryrefslogtreecommitdiff
path: root/modules/nerd-icons-config.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-16 02:56:25 -0500
committerCraig Jennings <c@cjennings.net>2026-05-16 02:56:25 -0500
commit70c4e1272db2e712c82024d982c1de3dda70b861 (patch)
treedd4a1e0a87afd40e9a3c0eee500093eecb5339bf /modules/nerd-icons-config.el
parent19a73261008dc8d4fa497f1d64ad57fa845674ce (diff)
downloaddotemacs-70c4e1272db2e712c82024d982c1de3dda70b861.tar.gz
dotemacs-70c4e1272db2e712c82024d982c1de3dda70b861.zip
refactor(ui): four UI/navigation hygiene fixes from module-by-module re-review
- popper-config.el: move `(popper-mode +1)` and `(popper-echo-mode +1)` from the use-package `:init` block into `:config`. `:disabled t' on use-package skips `:config' but still runs `:init', so the previous shape enabled popper-mode on every load, including batch / test runs, despite the disabled marker. - modeline-config.el: make `cj/modeline-vc-fetch' fall back when the internal `vc-git--symbolic-ref' is missing. `require' uses `nil 'noerror', the call sits inside an `fboundp' guard, and `ignore-errors' wraps the call itself so an Emacs version that renames or removes the accessor leaves `branch' at `vc-working-revision''s output instead of crashing the modeline. - ui-config.el: guard the cursor-color `post-command-hook' behind `(display-graphic-p)' both at install time and inside the function body. Batch / TTY runs short-circuit cleanly with no per-command overhead. A `server-after-make-frame-hook' catches the daemon case where the first GUI frame is created after ui-config loads and installs the hook lazily. Updates test-ui-config--buffer-cursor-state and test-ui-cursor-color-integration to stub `display-graphic-p' so the work body still runs under batch. - nerd-icons-config.el: drop `:demand t' (`:defer t' now), keeping the `:config' advice install as the natural lazy-on-load path. Add a `with-eval-after-load 'nerd-icons' block as a safety net for the already-loaded case on re-eval; the block uses `advice-member-p' so the advice never stacks.
Diffstat (limited to 'modules/nerd-icons-config.el')
-rw-r--r--modules/nerd-icons-config.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/nerd-icons-config.el b/modules/nerd-icons-config.el
index 4a8ce194d..52a4627dc 100644
--- a/modules/nerd-icons-config.el
+++ b/modules/nerd-icons-config.el
@@ -70,11 +70,21 @@ every call. The `memq' check skips when the face is already present."
;; ------------------------------- Packages ------------------------------------
(use-package nerd-icons
- :demand t
+ :defer t
:config
(advice-add 'nerd-icons-icon-for-dir :filter-return #'cj/--nerd-icons-color-dir)
(cj/nerd-icons-apply-tint))
+;; If nerd-icons is already loaded (e.g. when this module is re-evaluated
+;; after a session in which a feature module already required it), the
+;; `:config' block above won't fire again -- fall through to install the
+;; advice and tint immediately.
+(with-eval-after-load 'nerd-icons
+ (unless (advice-member-p #'cj/--nerd-icons-color-dir 'nerd-icons-icon-for-dir)
+ (advice-add 'nerd-icons-icon-for-dir
+ :filter-return #'cj/--nerd-icons-color-dir))
+ (cj/nerd-icons-apply-tint))
+
(use-package nerd-icons-completion
:demand t
:after (nerd-icons marginalia)