branch: elpa/projectile
commit f8f6ace05247387328e72077030da3f250361cf5
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Fix hook management in projectile-mode enable/disable
Two issues:
1. projectile-find-dir-hook was added on mode enable but never removed
on disable, leaking the hook function after turning off the mode.
2. dired-before-readin-hook was added with the LOCAL flag, but
projectile-mode is a global mode. This meant the hook only fired
in whichever buffer happened to be current when the mode was enabled,
not in all dired buffers. Remove the LOCAL flag and clean it up
properly on disable.
---
projectile.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/projectile.el b/projectile.el
index 87c8530330..ae5bf6653c 100644
--- a/projectile.el
+++ b/projectile.el
@@ -6542,14 +6542,15 @@ Otherwise behave as if called interactively.
(add-hook 'project-find-functions #'project-projectile)
(add-hook 'find-file-hook 'projectile-find-file-hook-function)
(add-hook 'projectile-find-dir-hook
#'projectile-track-known-projects-find-file-hook t)
- (add-hook 'dired-before-readin-hook
#'projectile-track-known-projects-find-file-hook t t)
+ (add-hook 'dired-before-readin-hook
#'projectile-track-known-projects-find-file-hook t)
(add-hook 'window-configuration-change-hook
#'projectile-update-mode-line-on-window-change)
(advice-add 'compilation-find-file :around
#'compilation-find-file-projectile-find-compilation-buffer)
(advice-add 'delete-file :before
#'delete-file-projectile-remove-from-cache))
(t
(remove-hook 'project-find-functions #'project-projectile)
(remove-hook 'find-file-hook #'projectile-find-file-hook-function)
- (remove-hook 'dired-before-readin-hook
#'projectile-track-known-projects-find-file-hook t)
+ (remove-hook 'projectile-find-dir-hook
#'projectile-track-known-projects-find-file-hook)
+ (remove-hook 'dired-before-readin-hook
#'projectile-track-known-projects-find-file-hook)
(remove-hook 'window-configuration-change-hook
#'projectile-update-mode-line-on-window-change)
(advice-remove 'compilation-find-file
#'compilation-find-file-projectile-find-compilation-buffer)
(advice-remove 'delete-file #'delete-file-projectile-remove-from-cache))))