aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.dev>2026-02-28 08:44:03 +0200
committerBozhidar Batsov <bozhidar@batsov.dev>2026-02-28 08:54:10 +0200
commitf8f6ace05247387328e72077030da3f250361cf5 (patch)
treeb1d57882c113585801753be2eb8d0c58de86a678
parent45a748039f4ed901e02bfe651c09e729e45d7450 (diff)
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.
-rw-r--r--projectile.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/projectile.el b/projectile.el
index 87c8530..ae5bf66 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))))