From 78ee7e36f94c88c2f2626350be441c31f884d60f Mon Sep 17 00:00:00 2001 From: ericdanan Date: Wed, 21 Sep 2016 18:02:12 +0200 Subject: [PATCH] [Fix #1005] Load dir-locals before switching project (#1051) Also fixes #413. --- projectile.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/projectile.el b/projectile.el index ca64a917c..b0161224a 100644 --- a/projectile.el +++ b/projectile.el @@ -2845,12 +2845,15 @@ With a prefix ARG invokes `projectile-commander' instead of Invokes the command referenced by `projectile-switch-project-action' on switch. With a prefix ARG invokes `projectile-commander' instead of `projectile-switch-project-action.'" - (let* ((default-directory project-to-switch) - (switch-project-action (if arg + (let ((switch-project-action (if arg 'projectile-commander projectile-switch-project-action))) (run-hooks 'projectile-before-switch-project-hook) - (funcall switch-project-action) + ;; use a temporary buffer to load PROJECT-TO-SWITCH's dir-locals before calling SWITCH-PROJECT-ACTION + (with-temp-buffer + (let ((default-directory project-to-switch)) + (hack-dir-local-variables-non-file-buffer) + (funcall switch-project-action))) (run-hooks 'projectile-after-switch-project-hook))) ;;;###autoload