mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
tools/magit: update vc on +magit/quit
Instead of magit-post-refresh-hook, which fires much more frequently. Updating vc across all buffers is expensive, so let's only do it when we quit magit. Warning: this may make quitting magit expensive when you have many buffers open. Still searching for a better solution.
This commit is contained in:
@ -50,9 +50,16 @@
|
||||
|
||||
;;;###autoload
|
||||
(defun +magit/quit (&optional _kill-buffer)
|
||||
"Clean up magit buffers after quitting `magit-status'."
|
||||
"Clean up magit buffers after quitting `magit-status' and refresh version
|
||||
control in buffers."
|
||||
(interactive)
|
||||
(mapc #'+magit--kill-buffer (magit-mode-get-buffers)))
|
||||
(mapc #'+magit--kill-buffer (magit-mode-get-buffers))
|
||||
(dolist (buffer (buffer-list))
|
||||
(with-current-buffer buffer
|
||||
(when (fboundp 'vc-refresh-state)
|
||||
(vc-refresh-state))
|
||||
(when (fboundp '+version-control|update-git-gutter)
|
||||
(+version-control|update-git-gutter)))))
|
||||
|
||||
(defun +magit--kill-buffer (buf)
|
||||
"TODO"
|
||||
|
Reference in New Issue
Block a user