diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-14 14:19:45 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-14 14:19:45 -0500 |
| commit | af2ad1febf87027cbd4408312c1fff2815a9a0ff (patch) | |
| tree | 4a40812ea73abf8954f46ae7781a6d8106d57874 /tests/test-modeline-config-vc-cache.el | |
| parent | 269f23a38789190d112b04e8e70c3a6d649193b1 (diff) | |
| download | dotemacs-af2ad1febf87027cbd4408312c1fff2815a9a0ff.tar.gz dotemacs-af2ad1febf87027cbd4408312c1fff2815a9a0ff.zip | |
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.
Diffstat (limited to 'tests/test-modeline-config-vc-cache.el')
| -rw-r--r-- | tests/test-modeline-config-vc-cache.el | 7 |
1 files changed, 7 insertions, 0 deletions
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 |
