mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
fix(workspaces): only trigger projectile-*-switch-project-hook once
Changes upstream made our triggers for these hooks redundant. Fix: #6559
This commit is contained in:
@ -562,17 +562,10 @@ the user to open a file in the new project.
|
|||||||
This be hooked to `projectile-after-switch-project-hook'."
|
This be hooked to `projectile-after-switch-project-hook'."
|
||||||
(when dir
|
(when dir
|
||||||
(setq +workspaces--project-dir dir))
|
(setq +workspaces--project-dir dir))
|
||||||
;; HACK Clear projectile-project-root, otherwise cached roots may interfere
|
;; HACK: Clear projectile-project-root or cached roots could interfere with
|
||||||
;; with project switch (see #3166)
|
;; project switching (see #3166).
|
||||||
(let (projectile-project-root)
|
(let (projectile-project-root)
|
||||||
(when (and persp-mode +workspaces--project-dir)
|
(when (and persp-mode +workspaces--project-dir)
|
||||||
(when projectile-before-switch-project-hook
|
|
||||||
(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
|
(unwind-protect
|
||||||
(if (and (not (null +workspaces-on-switch-project-behavior))
|
(if (and (not (null +workspaces-on-switch-project-behavior))
|
||||||
(or (eq +workspaces-on-switch-project-behavior t)
|
(or (eq +workspaces-on-switch-project-behavior t)
|
||||||
@ -600,7 +593,6 @@ This be hooked to `projectile-after-switch-project-hook'."
|
|||||||
(+workspace-rename (+workspace-current-name) (doom-project-name +workspaces--project-dir)))
|
(+workspace-rename (+workspace-current-name) (doom-project-name +workspaces--project-dir)))
|
||||||
(unless current-prefix-arg
|
(unless current-prefix-arg
|
||||||
(funcall +workspaces-switch-project-function +workspaces--project-dir)))
|
(funcall +workspaces-switch-project-function +workspaces--project-dir)))
|
||||||
(run-hooks 'projectile-after-switch-project-hook)
|
|
||||||
(setq +workspaces--project-dir nil)))))
|
(setq +workspaces--project-dir nil)))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
Reference in New Issue
Block a user