diff --git a/modules/tools/magit/autoload.el b/modules/tools/magit/autoload.el index 72df14f4f..d6cda9596 100644 --- a/modules/tools/magit/autoload.el +++ b/modules/tools/magit/autoload.el @@ -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" diff --git a/modules/tools/magit/config.el b/modules/tools/magit/config.el index 6792eecec..413ae80ac 100644 --- a/modules/tools/magit/config.el +++ b/modules/tools/magit/config.el @@ -47,14 +47,7 @@ available.") ;; Don't replace the leader key ;; FIXME remove me when general.el is integrated - (define-key magit-diff-mode-map (kbd doom-leader-key) nil) - - (defun +magit|update-vc () - "Update vc in all verson-controlled buffers when magit refreshes." - (dolist (buf (buffer-list)) - (with-current-buffer buf - (vc-refresh-state)))) - (add-hook 'magit-post-refresh-hook #'+magit|update-vc)) + (define-key magit-diff-mode-map (kbd doom-leader-key) nil)) (def-package! magit-todos