From ed9d7feb367127b095fd96bb2d7a1f8c852cbf9c Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 9 Jul 2019 19:54:21 +0200 Subject: [PATCH] projectile: persist projectile-projects-cache-time This way, projectile caches won't expire when restarting Emacs, but instead time + projectile-files-cache-expire seconds from the time it is serialized. --- core/core-projects.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/core-projects.el b/core/core-projects.el index 053beadd9..3facb6533 100644 --- a/core/core-projects.el +++ b/core/core-projects.el @@ -13,6 +13,10 @@ Emacs.") (defvar doom-projectile-fd-binary "fd" "name of `fd-find' executable binary") +(defvar doom-projectile-cache-timer-file (concat doom-cache-dir "projectile.timers") + "Where to save project file cache timers.") + + ;; ;;; Packages @@ -39,6 +43,14 @@ Emacs.") (global-set-key [remap find-tag] #'projectile-find-tag) :config + (defun doom*projectile-cache-timers () + "Persist `projectile-projects-cache-time' across sessions, so that +`projectile-files-cache-expire' checks won't reset when restarting Emacs." + (projectile-serialize projectile-projects-cache-time doom-projectile-cache-timer-file)) + (advice-add #'projectile-serialize-cache :before #'doom*projectile-cache-timers) + ;; Restore it + (setq projectile-projects-cache-time (projectile-unserialize doom-projectile-cache-timer-file)) + (add-hook 'dired-before-readin-hook #'projectile-track-known-projects-find-file-hook) (projectile-mode +1)