Refresh vc when magit refreshes #826
Magit does not inform vc that changes have occurred to open buffers. This fixes that (and indirectly fixes branch display in the modeline).
This commit is contained in:
parent
c7abe743d1
commit
641cef9848
2 changed files with 10 additions and 1 deletions
|
@ -36,7 +36,15 @@ available.")
|
|||
(add-hook! '(magit-mode-hook magit-popup-mode-hook)
|
||||
#'hide-mode-line-mode)
|
||||
;; properly kill leftover magit buffers on quit
|
||||
(define-key magit-status-mode-map [remap magit-mode-bury-buffer] #'+magit/quit))
|
||||
(define-key magit-status-mode-map [remap magit-mode-bury-buffer] #'+magit/quit)
|
||||
|
||||
(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))
|
||||
|
||||
|
||||
|
||||
(def-package! magit-todos
|
||||
|
|
|
@ -529,6 +529,7 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
|||
(add-hook 'after-revert-hook #'+doom-modeline--update-vcs)
|
||||
(add-hook 'after-save-hook #'+doom-modeline--update-vcs)
|
||||
(add-hook 'find-file-hook #'+doom-modeline--update-vcs t)
|
||||
(advice-add #'vc-refresh-state :after #'+doom-modeline--update-vcs)
|
||||
|
||||
(def-modeline-segment! vcs
|
||||
"Displays the current branch, colored based on its state."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue