File Name Cache in Emacs 28.1: Add Automatic Invalidation on External Changes?
0 reputation · 26 Nov 2023, 08:59 UTC
Goal
Ensure that Emacs accurately reflects changes made to files outside the editor by keeping the file-name-cache up‑to‑date.
Current Constraint
In Emacs 28.1 the cache is cleared only manually via clear-file-name-cache or when file-name-cache-size is exceeded. There is no hook that automatically removes stale entries when a file is modified on disk.
Unresolved Decision
Should an advisory be added to file‑system change hooks to clear relevant cache entries, or should the entire cache be purged? The trade‑off between correctness and performance remains undecided in the documentation.
Questions
- Would adding an advisory to
file-attributesor related file‑system hooks reliably invalidate only the affected cache entries without causing noticeable slowdown? - Is it preferable to clear the entire
file-name-cacheon any external modification, or to target specific entries to preserve cache benefits? - What impact would such automatic clearing have on multi‑process or server mode sessions where cache coherence is critical?