Skip to content

Commit a45ce1e

Browse files
committed
fix(magit): do less on magit-refresh-buffer
Inhibit recentf-cleanup and projectile caching, and silence it's logging on refresh-buffer. The former can potentially be slow and isn't necessary on top of invalidating the cache, and the latter is noise.
1 parent dddc019 commit a45ce1e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Diff for: modules/tools/magit/config.el

+10-4
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,18 @@ FUNCTION
7171
;; Turn ref links into clickable buttons.
7272
(add-hook 'magit-process-mode-hook #'goto-address-mode)
7373

74-
;; Since the project likely now contains new files, best we undo the
75-
;; projectile cache so it can be regenerated later.
74+
;; Since the project likely now contains new files, purge the projectile cache
75+
;; so `projectile-find-file' et all don't produce an stale file list.
7676
(add-hook! 'magit-refresh-buffer-hook
7777
(defun +magit-invalidate-projectile-cache-h ()
78-
(let (projectile-require-project-root)
79-
(projectile-invalidate-cache nil))))
78+
;; Only invalidate the hot cache and nothing else (everything else is
79+
;; expensive busy work, and we don't want to slow down magit's
80+
;; refreshing).
81+
(let (projectile-require-project-root
82+
projectile-enable-caching
83+
projectile-verbose)
84+
(letf! ((#'recentf-cleanup #'ignore))
85+
(projectile-invalidate-cache nil)))))
8086
;; Use a more efficient strategy to auto-revert buffers whose git state has
8187
;; changed: refresh the visible buffers immediately...
8288
(add-hook 'magit-post-refresh-hook #'+magit-mark-stale-buffers-h)

0 commit comments

Comments
 (0)