From d618bb4620d5d651027e772b8ccc490e1bab6d80 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 16 May 2026 02:56:25 -0500 Subject: 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. --- modules/modeline-config.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'modules/modeline-config.el') diff --git a/modules/modeline-config.el b/modules/modeline-config.el index 771d960f..61ab0f9d 100644 --- a/modules/modeline-config.el +++ b/modules/modeline-config.el @@ -141,15 +141,20 @@ Uses built-in cached values for performance.") (defun cj/modeline-vc-fetch (file) "Fetch modeline VC data for FILE. -Return a plist with `:branch' and `:state', or nil when FILE has no VC data." +Return a plist with `:branch' and `:state', or nil when FILE has no VC data. +Uses `vc-git--symbolic-ref' for branch names when available (it returns the +symbolic ref like \"main\" instead of a SHA when HEAD is on a branch), but +falls back to `vc-working-revision' if the internal accessor is missing -- +the symbol is internal and can be renamed or removed between Emacs versions." (unless (and (file-remote-p file) (not cj/modeline-vc-show-remote)) (when-let* ((backend (vc-backend file)) (branch (vc-working-revision file backend))) (when (eq backend 'Git) (unless (fboundp 'vc-git--symbolic-ref) - (require 'vc-git)) - (when-let* ((symbolic (vc-git--symbolic-ref file))) - (setq branch symbolic))) + (require 'vc-git nil 'noerror)) + (when (fboundp 'vc-git--symbolic-ref) + (when-let* ((symbolic (ignore-errors (vc-git--symbolic-ref file)))) + (setq branch symbolic)))) (list :branch branch :state (vc-state file backend))))) -- cgit v1.2.3