mirror of
https://github.com/correl/doom-modeline.git
synced 2024-11-27 19:19:53 +00:00
Update vc state on modeline while selecting the window.
This might address this issue:
Modeline VC branch name not updating on magit-checkout.
In doom-modeline, only show vc state in active window, so
it makes sense to update vc state while selecting the
window, and it won't bring performance issue.
Refer to:
https://github.com/hlissner/doom-emacs/issues/826
3d8e81b7e1
This commit is contained in:
parent
b020f8b0a7
commit
f7a573906d
1 changed files with 2 additions and 2 deletions
|
@ -661,7 +661,7 @@ directory, the file name, and its state (modified, read-only or non-existent)."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
(defvar-local doom-modeline--vcs nil)
|
(defvar-local doom-modeline--vcs nil)
|
||||||
(defun doom-modeline--update-vcs ()
|
(defun doom-modeline--update-vcs (&rest _)
|
||||||
"Update vsc state in mode-line."
|
"Update vsc state in mode-line."
|
||||||
(setq doom-modeline--vcs
|
(setq doom-modeline--vcs
|
||||||
(when (and vc-mode buffer-file-name)
|
(when (and vc-mode buffer-file-name)
|
||||||
|
@ -699,7 +699,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-revert-hook #'doom-modeline--update-vcs)
|
||||||
(add-hook 'after-save-hook #'doom-modeline--update-vcs)
|
(add-hook 'after-save-hook #'doom-modeline--update-vcs)
|
||||||
(add-hook 'find-file-hook #'doom-modeline--update-vcs t)
|
(add-hook 'find-file-hook #'doom-modeline--update-vcs t)
|
||||||
(advice-add #'vc-refresh-state :after #'doom-modeline--update-vcs)
|
(advice-add #'select-window :after #'doom-modeline--update-vcs)
|
||||||
|
|
||||||
(doom-modeline-def-segment vcs
|
(doom-modeline-def-segment vcs
|
||||||
"Displays the current branch, colored based on its state."
|
"Displays the current branch, colored based on its state."
|
||||||
|
|
Loading…
Reference in a new issue