Fix #2591: fix project switch hooks not running

When :ui workspaces was enabled.
This commit is contained in:
Henrik Lissner 2020-02-24 20:46:58 -05:00
parent d6c81b6877
commit 8049914e0e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -526,6 +526,12 @@ This be hooked to `projectile-after-switch-project-hook'."
(when dir
(setq +workspaces--project-dir dir))
(when (and persp-mode +workspaces--project-dir)
(with-temp-buffer
;; Load the project dir-local variables into the switch buffer, so the
;; action can make use of them
(setq default-directory +workspaces--project-dir)
(hack-dir-local-variables-non-file-buffer)
(run-hooks 'projectile-before-switch-project-hook))
(unwind-protect
(if (and (not (null +workspaces-on-switch-project-behavior))
(or (eq +workspaces-on-switch-project-behavior t)
@ -550,6 +556,7 @@ This be hooked to `projectile-after-switch-project-hook'."
(+workspace-rename (+workspace-current-name) (doom-project-name +workspaces--project-dir)))
(unless current-prefix-arg
(funcall +workspaces-switch-project-function +workspaces--project-dir)))
(run-hooks 'projectile-after-switch-project-hook)
(setq +workspaces--project-dir nil))))