Skip to content

Stop re-indexing on every find-file in projects with a .projectile - #2196

Merged
bbatsov merged 2 commits into
masterfrom
feature/2193-dirconfig-cache-invalidation
Sep 30, 2026
Merged

bbatsov merged 2 commits into
masterfrom
feature/2193-dirconfig-cache-invalidation

Conversation

@bbatsov

@bbatsov bbatsov commented Sep 29, 2026

Copy link
Copy Markdown
Owner

The dirconfig staleness check compared .projectile against the persistent cache file, which the default in-memory cache never writes, so it always said stale. It now uses the time the in-memory cache was filled. That time is in whole seconds, so an edit in the same second as indexing costs one extra re-index rather than risking a missed edit.

Fixes #2193


  • The commits are consistent with our contribution guidelines
  • You've added tests (if possible) to cover your change(s)
  • All tests are passing (eldev test)
  • The new code is not generating bytecode or M-x checkdoc warnings
  • You've updated the changelog (if adding/changing user-visible functionality)
  • You've updated the docs (when adding new project types, configuration options, commands, etc)

projectile-maybe-invalidate-cache compared .projectile against the
persistent cache file, and file-newer-than-file-p is true when that file
doesn't exist. Since 2.9.0 made the cache in-memory by default no such
file is written, so every find-file in a project with a .projectile
threw the cache away and re-indexed.

The in-memory cache already records when it was filled, so compare
against that, fall back to the cache file only when nothing is cached in
memory, and treat no cache at all as nothing to invalidate.
@bbatsov
bbatsov merged commit 4d2be86 into master Sep 30, 2026
5 checks passed
@bbatsov
bbatsov deleted the feature/2193-dirconfig-cache-invalidation branch September 30, 2026 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

projectile-find-file always invalidates cache

1 participant