mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
fix: projectile: centralize per-project cache files
Projectile was bumped in #8317, which introduced per-project file caches, but they were written to the root of the project. Rather than litter projects with these dotfiles, I advise projectile to write them to a single place (under `doom-profile-cache-dir`). Also moves the known-projectiles cache file to the same directory. Amend: #8317
This commit is contained in:
@ -14,6 +14,9 @@ Is nil if no executable is found in your PATH during startup.")
|
|||||||
|
|
||||||
Is nil if no executable is found in your PATH during startup.")
|
Is nil if no executable is found in your PATH during startup.")
|
||||||
|
|
||||||
|
(defvar doom-projectile-cache-dir (file-name-concat doom-profile-cache-dir "projectile")
|
||||||
|
"The directory where per-project projectile file index caches are stored.")
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Packages
|
;;; Packages
|
||||||
@ -49,7 +52,7 @@ Is nil if no executable is found in your PATH during startup.")
|
|||||||
projectile-globally-ignored-file-suffixes '(".elc" ".pyc" ".o")
|
projectile-globally-ignored-file-suffixes '(".elc" ".pyc" ".o")
|
||||||
projectile-kill-buffers-filter 'kill-only-files
|
projectile-kill-buffers-filter 'kill-only-files
|
||||||
projectile-ignored-projects '("~/")
|
projectile-ignored-projects '("~/")
|
||||||
projectile-known-projects-file (concat doom-cache-dir "projectile-projects.eld")
|
projectile-known-projects-file (concat doom-projectile-cache-dir "projects.eld")
|
||||||
projectile-ignored-project-function #'doom-project-ignored-p
|
projectile-ignored-project-function #'doom-project-ignored-p
|
||||||
projectile-fd-executable doom-fd-executable)
|
projectile-fd-executable doom-fd-executable)
|
||||||
|
|
||||||
@ -57,6 +60,8 @@ Is nil if no executable is found in your PATH during startup.")
|
|||||||
(global-set-key [remap find-tag] #'projectile-find-tag)
|
(global-set-key [remap find-tag] #'projectile-find-tag)
|
||||||
|
|
||||||
:config
|
:config
|
||||||
|
(make-directory doom-projectile-cache-dir t)
|
||||||
|
|
||||||
;; HACK: Auto-discovery and cleanup on `projectile-mode' is slow and
|
;; HACK: Auto-discovery and cleanup on `projectile-mode' is slow and
|
||||||
;; premature. Let's try to defer it until it's needed.
|
;; premature. Let's try to defer it until it's needed.
|
||||||
(add-transient-hook! 'projectile-relevant-known-projects
|
(add-transient-hook! 'projectile-relevant-known-projects
|
||||||
@ -97,6 +102,17 @@ Is nil if no executable is found in your PATH during startup.")
|
|||||||
(setq compilation-buffer-name-function #'projectile-compilation-buffer-name
|
(setq compilation-buffer-name-function #'projectile-compilation-buffer-name
|
||||||
compilation-save-buffers-predicate #'projectile-current-project-buffer-p)
|
compilation-save-buffers-predicate #'projectile-current-project-buffer-p)
|
||||||
|
|
||||||
|
;; Centralize Projectile's per-project cache files, so they don't litter
|
||||||
|
;; projects with dotfiles.
|
||||||
|
(defadvice! doom--projectile-centralized-cache-files-a (fn &optional proot)
|
||||||
|
:around #'projectile-project-cache-file
|
||||||
|
(let* ((proot (abbreviate-file-name (or proot (doom-project-root))))
|
||||||
|
(projectile-cache-file
|
||||||
|
(expand-file-name
|
||||||
|
(format "%s-%s" (doom-project-name proot) (sha1 proot))
|
||||||
|
doom-projectile-cache-dir)))
|
||||||
|
(funcall fn proot)))
|
||||||
|
|
||||||
;; Support the more generic .project files as an alternative to .projectile
|
;; Support the more generic .project files as an alternative to .projectile
|
||||||
(defadvice! doom--projectile-dirconfig-file-a ()
|
(defadvice! doom--projectile-dirconfig-file-a ()
|
||||||
:override #'projectile-dirconfig-file
|
:override #'projectile-dirconfig-file
|
||||||
|
Reference in New Issue
Block a user