mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
refactor: projectile init
Reassessing our startup hacks for projectile, and removing ones we no longer need.
This commit is contained in:
@ -44,10 +44,7 @@ Is nil if no executable is found in your PATH during startup.")
|
||||
projectile-locate-dominating-file
|
||||
projectile-relevant-known-projects)
|
||||
:init
|
||||
(setq ;; Auto-discovery is slow to do by default. Better to update the list
|
||||
;; when you need to (`projectile-discover-projects-in-search-path').
|
||||
projectile-auto-discover nil
|
||||
projectile-enable-caching (if noninteractive t 'persistent)
|
||||
(setq projectile-enable-caching (if noninteractive t 'persistent)
|
||||
projectile-globally-ignored-files '(".DS_Store" "TAGS")
|
||||
projectile-globally-ignored-file-suffixes '(".elc" ".pyc" ".o")
|
||||
projectile-kill-buffers-filter 'kill-only-files
|
||||
@ -62,13 +59,6 @@ Is nil if no executable is found in your PATH during startup.")
|
||||
:config
|
||||
(make-directory doom-projectile-cache-dir t)
|
||||
|
||||
;; HACK: Auto-discovery and cleanup on `projectile-mode' is slow and
|
||||
;; premature. Let's try to defer it until it's needed.
|
||||
(add-transient-hook! 'projectile-relevant-known-projects
|
||||
(projectile--cleanup-known-projects)
|
||||
(when projectile-auto-discover
|
||||
(projectile-discover-projects-in-search-path)))
|
||||
|
||||
;; Projectile runs four functions to determine the root (in this order):
|
||||
;;
|
||||
;; + `projectile-root-local' -> checks the `projectile-project-root' variable
|
||||
@ -209,20 +199,7 @@ the command instead."
|
||||
:around #'projectile-default-generic-command
|
||||
(ignore-errors (apply fn args)))
|
||||
|
||||
;; HACK: Projectile cleans up the known projects list at startup. If this list
|
||||
;; contains tramp paths, the `file-remote-p' calls will pull in tramp via
|
||||
;; its `file-name-handler-alist' entry, which is expensive. Since Doom
|
||||
;; already cleans up the project list on kill-emacs-hook, it's simplest to
|
||||
;; inhibit this cleanup process at startup (see bbatsov/projectile#1649).
|
||||
(letf! ((#'projectile--cleanup-known-projects #'ignore))
|
||||
(projectile-mode +1)
|
||||
;; HACK: See bbatsov/projectile@3c92d28c056c
|
||||
(remove-hook 'buffer-list-update-hook #'projectile-track-known-projects-find-file-hook)
|
||||
(add-hook 'doom-switch-buffer-hook #'projectile-track-known-projects-find-file-hook t)
|
||||
(add-hook! 'dired-after-readin-hook
|
||||
(defun doom-project-track-known-project-h ()
|
||||
(when projectile-mode
|
||||
(projectile-track-known-projects-find-file-hook))))))
|
||||
(projectile-mode +1))
|
||||
|
||||
|
||||
;;
|
||||
|
Reference in New Issue
Block a user