diff options
| author | Bozhidar Batsov <bozhidar@batsov.dev> | 2026-02-15 18:22:55 +0200 |
|---|---|---|
| committer | Bozhidar Batsov <bozhidar@batsov.dev> | 2026-02-15 18:22:55 +0200 |
| commit | a80b19dd49bc588cffd9df3adc4b7581713c5cf0 (patch) | |
| tree | a105f0be050775d75b630bcb458f7ef8fff29c10 | |
| parent | dd06dfd912656d41f2c63066aa8bacb898ddf7a2 (diff) | |
Add projectile-invalidate-all-caches commandfeature/1694-invalidate-all-caches
Closes #1694
Add a command that clears the file cache for all known projects at once.
This is useful when using projectile-find-file-in-known-projects, where
stale files from other projects could appear since
projectile-invalidate-cache only clears the current project.
| -rw-r--r-- | projectile.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/projectile.el b/projectile.el index 6c5306b..4b40143 100644 --- a/projectile.el +++ b/projectile.el @@ -1130,6 +1130,23 @@ argument)." (when (fboundp 'recentf-cleanup) (recentf-cleanup))) +;;;###autoload +(defun projectile-invalidate-all-caches () + "Remove the cache files for all known projects." + (interactive) + (setq projectile-project-root-cache (make-hash-table :test 'equal)) + (clrhash projectile-project-type-cache) + (let ((projects (hash-table-keys projectile-projects-cache))) + (clrhash projectile-projects-cache) + (clrhash projectile-projects-cache-time) + (when (projectile-persistent-cache-p) + (dolist (project-root projects) + (projectile-serialize nil (projectile-project-cache-file project-root))))) + (when projectile-verbose + (message "Invalidated Projectile cache for all projects.")) + (when (fboundp 'recentf-cleanup) + (recentf-cleanup))) + (defun projectile-time-seconds () "Return the number of seconds since the unix epoch." (time-convert nil 'integer)) |
