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 | e8fead57164c1bf6b1cf050026f6502b969ddc80 (patch) | |
| tree | 1287782ebb27149d31aac5a6ee813823614d2f9c /tests/test-modeline-config-vc-cache.el | |
| parent | f0219296bd5810eb016c264105f04b345cf47281 (diff) | |
| download | dotemacs-e8fead57164c1bf6b1cf050026f6502b969ddc80.tar.gz dotemacs-e8fead57164c1bf6b1cf050026f6502b969ddc80.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 b6aafbfb..dab75544 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 |
