From 2d4b946e032765d73eaf4f48a7da5d3dc8185815 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 1 Jun 2020 18:15:53 -0400 Subject: [PATCH] Clear project-root cache before switching project Fixes #3205 May address #3166 --- core/core-projects.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/core-projects.el b/core/core-projects.el index 627b66c0c..2fce0b554 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -46,9 +46,16 @@ Emacs.") ;; 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) + focus-in-hook + ;; ...or when we change the current project! + projectile-after-switch-project-hook) projectile-project-root (if default-directory (doom-project-root))) + ;; However, it may become a problem when switching projects, so remove the + ;; cached value when switching projects. + (setq-hook! 'projectile-before-switch-project-hook + projectile-project-root nil) + ;; Projectile runs four functions to determine the root (in this order): ;; ;; + `projectile-root-local' -> checks the `projectile-project-root' variable