Watch doom-modeline-buffer-file-name-style to update buffer info.

This commit is contained in:
Vincent Zhang 2018-11-15 16:05:38 +08:00
parent 781ce1b3c2
commit 561560dfe5

View file

@ -629,6 +629,13 @@ buffer where knowing the current project directory is important."
(add-hook 'after-save-hook #'doom-modeline-update-buffer-file-name) (add-hook 'after-save-hook #'doom-modeline-update-buffer-file-name)
(advice-add #'rename-buffer :after #'doom-modeline-update-buffer-file-name) (advice-add #'rename-buffer :after #'doom-modeline-update-buffer-file-name)
(when (>= emacs-major-version 26)
(add-variable-watcher
'doom-modeline-buffer-file-name-style
(lambda (_sym _val op _where)
(when (eq op 'set)
(doom-modeline-update-buffer-file-name)))))
(doom-modeline-def-segment buffer-info (doom-modeline-def-segment buffer-info
"Combined information about the current buffer, including the current working "Combined information about the current buffer, including the current working
directory, the file name, and its state (modified, read-only or non-existent)." directory, the file name, and its state (modified, read-only or non-existent)."