Update buffer file name after renaming a buffer.

This commit is contained in:
Vincent Zhang 2018-11-15 03:40:21 +08:00
parent 09ed39a941
commit a75f6f2ec8

View file

@ -610,7 +610,7 @@ buffer where knowing the current project directory is important."
;; ;;
(defvar-local doom-modeline-buffer-file-name nil) (defvar-local doom-modeline-buffer-file-name nil)
(defun doom-modeline-update-buffer-file-name () (defun doom-modeline-update-buffer-file-name (&rest _)
"Propertized variable `buffer-file-name' based on `doom-modeline-buffer-file-name-style'." "Propertized variable `buffer-file-name' based on `doom-modeline-buffer-file-name-style'."
(setq doom-modeline-buffer-file-name (setq doom-modeline-buffer-file-name
;; Show buffer name if it doesn't equal the file name. ;; Show buffer name if it doesn't equal the file name.
@ -628,6 +628,7 @@ buffer where knowing the current project directory is important."
(add-hook 'after-revert-hook #'doom-modeline-update-buffer-file-name) (add-hook 'after-revert-hook #'doom-modeline-update-buffer-file-name)
(add-hook 'after-save-hook #'doom-modeline-update-buffer-file-name) (add-hook 'after-save-hook #'doom-modeline-update-buffer-file-name)
(add-hook 'git-timemachine-mode-hook #'doom-modeline-update-buffer-file-name) (add-hook 'git-timemachine-mode-hook #'doom-modeline-update-buffer-file-name)
(advice-add #'rename-buffer :after #'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