From af2ad1febf87027cbd4408312c1fff2815a9a0ff Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 14 Jun 2026 14:19:45 -0500 Subject: fix(modeline): drop per-render truename, guard vc fetch against signals The VC modeline cache rebuilt its key every render, and the key included file-truename, so a stat ran on every redisplay rather than once per refresh as the comment claimed. Now it keys on (file show-remote). A moved symlink target is caught at the next TTL refresh, when vc-backend resolves the link fresh. And cj/modeline-vc-fetch is wrapped in condition-case returning nil, so a git signal on a slow or unmounted filesystem degrades to no-VC-info instead of breaking all redisplay. --- tests/test-modeline-config-vc-cache.el | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/test-modeline-config-vc-cache.el') diff --git a/tests/test-modeline-config-vc-cache.el b/tests/test-modeline-config-vc-cache.el index b6aafbfbe..dab755442 100644 --- a/tests/test-modeline-config-vc-cache.el +++ b/tests/test-modeline-config-vc-cache.el @@ -98,5 +98,12 @@ (should (text-property-any 0 (length rendered) 'mouse-face 'mode-line-highlight rendered))))) +(ert-deftest test-modeline-config-vc-fetch-swallows-vc-errors () + "Error: a signal from the VC backend is swallowed (returns nil) rather than +propagating into the mode-line redisplay path, where it would break all redisplay." + (cl-letf (((symbol-function 'file-remote-p) (lambda (&rest _) nil)) + ((symbol-function 'vc-backend) (lambda (&rest _) (error "git boom")))) + (should (null (cj/modeline-vc-fetch "/tmp/project/file.el"))))) + (provide 'test-modeline-config-vc-cache) ;;; test-modeline-config-vc-cache.el ends here -- cgit v1.2.3