diff --git a/lisp/doom-projects.el b/lisp/doom-projects.el index 70e17c4c4..d26a14b6e 100644 --- a/lisp/doom-projects.el +++ b/lisp/doom-projects.el @@ -2,16 +2,6 @@ ;;; Commentary: ;;; Code: -(defvar doom-projectile-cache-limit 10000 - "If any project cache surpasses this many files it is purged when quitting -Emacs.") - -(defvar doom-projectile-cache-blacklist '("~" "/tmp" "/") - "Directories that should never be cached.") - -(defvar doom-projectile-cache-purge-non-projects nil - "If non-nil, non-projects are purged from the cache on `kill-emacs-hook'.") - (define-obsolete-variable-alias 'doom-projectile-fd-binary 'doom-fd-executable "3.0.0") (defvar doom-fd-executable (cl-find-if #'executable-find (list "fdfind" "fd")) "The filename of the fd executable. @@ -51,16 +41,15 @@ Is nil if no executable is found in your PATH during startup.") projectile-locate-dominating-file projectile-relevant-known-projects) :init - (setq projectile-cache-file (concat doom-cache-dir "projectile.cache") - ;; Auto-discovery is slow to do by default. Better to update the list + (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 (not noninteractive) + 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 - projectile-known-projects-file (concat doom-cache-dir "projectile.projects") projectile-ignored-projects '("~/") + projectile-known-projects-file (concat doom-cache-dir "projectile-projects.eld") projectile-ignored-project-function #'doom-project-ignored-p projectile-fd-executable doom-fd-executable) @@ -121,40 +110,6 @@ Is nil if no executable is found in your PATH during startup.") (put 'projectile-ripgrep 'disabled "Use +default/search-project instead") (put 'projectile-grep 'disabled "Use +default/search-project instead") - ;; Accidentally indexing big directories like $HOME or / will massively bloat - ;; projectile's cache (into the hundreds of MBs). This purges those entries - ;; when exiting Emacs to prevent slowdowns/freezing when cache files are - ;; loaded or written to. - (add-hook! 'kill-emacs-hook - (defun doom-cleanup-project-cache-h () - "Purge projectile cache entries that: - -a) have too many files (see `doom-projectile-cache-limit'), -b) represent blacklisted directories that are too big, change too often or are - private. (see `doom-projectile-cache-blacklist'), -c) are not valid projectile projects." - (when (and (bound-and-true-p projectile-projects-cache) - projectile-enable-caching) - (setq projectile-known-projects - (cl-remove-if #'projectile-ignored-project-p - projectile-known-projects)) - (projectile-cleanup-known-projects) - (cl-loop with blacklist = (mapcar #'file-truename doom-projectile-cache-blacklist) - for proot in (hash-table-keys projectile-projects-cache) - if (or (not (stringp proot)) - (string-empty-p proot) - (>= (length (gethash proot projectile-projects-cache)) - doom-projectile-cache-limit) - (member (substring proot 0 -1) blacklist) - (and doom-projectile-cache-purge-non-projects - (not (doom-project-p proot))) - (projectile-ignored-project-p proot)) - do (doom-log "Removed %S from projectile cache" proot) - and do (remhash proot projectile-projects-cache) - and do (remhash proot projectile-projects-cache-time) - and do (remhash proot projectile-project-type-cache)) - (projectile-serialize-cache)))) - ;; HACK: Some MSYS utilities auto expanded the `/' path separator, so we need ;; to prevent it. (when doom--system-windows-p @@ -251,7 +206,6 @@ the command instead." (add-hook! 'dired-after-readin-hook (defun doom-project-track-known-project-h () (when projectile-mode - (setq projectile-project-root-cache (make-hash-table :test 'equal)) (projectile-track-known-projects-find-file-hook)))))) diff --git a/lisp/packages.el b/lisp/packages.el index 43cbc67b6..ca87fd3d9 100644 --- a/lisp/packages.el +++ b/lisp/packages.el @@ -34,7 +34,7 @@ (package! ws-butler :pin "e3a38d93e01014cd47bf5af4924459bd145fd7c4") ;; doom-projects.el -(package! projectile :pin "0a15d81be953150399170f4b8e53b86ee96ad639") +(package! projectile :pin "55db082cdf7b849335ccf24b7ba5aa2607d6fe93") (package! project :pin "2a3fe4c7dbb6cf4d449c4d358ec9aaf8658f6940") ;; doom-keybinds.el