diff --git a/core/core-projects.el b/core/core-projects.el index daca64c3a..ebb8d803e 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -40,6 +40,16 @@ Emacs.") :config (projectile-mode +1) + ;; REVIEW Resolve the project root once, when the file/buffer is opened. This + ;; speeds up projectile's project root resolution by leaps, but does + ;; put you at risk of having a stale project root. + (setq-hook! '(after-change-major-mode-hook + ;; In case the user saves the file to a new location + after-save-hook + ;; ...or makes external changes then returns to Emacs + focus-in-hook) + projectile-project-root (if default-directory (doom-project-root))) + ;; Projectile runs four functions to determine the root (in this order): ;; ;; + `projectile-root-local' -> checks the `projectile-project-root' variable