From d597663d6305ee746e9038ef39286b9c71c06097 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 31 Jul 2020 16:01:55 -0400 Subject: [PATCH] Discover projects on switch-project Rather than when projectile-mode is started up. Also clean up 404'ed projects on quit. --- core/core-projects.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/core-projects.el b/core/core-projects.el index 80bc8e683..0056dfeb5 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -42,6 +42,12 @@ debian, and derivatives). On most it's 'fd'.") :config (projectile-mode +1) + ;; Auto-discovery on `projectile-mode' is slow and premature. Let's defer it + ;; until it's actually needed. Also clean up non-existing projects too! + (add-transient-hook! 'projectile-relevant-known-projects + (projectile-cleanup-known-projects) + (projectile-discover-projects-in-search-path)) + ;; Projectile runs four functions to determine the root (in this order): ;; ;; + `projectile-root-local' -> checks the `projectile-project-root' variable @@ -107,6 +113,7 @@ c) are not valid projectile projects." (when (and (bound-and-true-p projectile-projects-cache) projectile-enable-caching doom-interactive-p) + (projectile-cleanup-known-projects) (cl-loop with blacklist = (mapcar #'file-truename doom-projectile-cache-blacklist) for proot in (hash-table-keys projectile-projects-cache) if (or (not (stringp proot))