Fix: conflict with lsp-on-revert/lsp-on-change.

Don't advice doom-modeline-set-selected-window (also bad performance).
And updating the buffer-file-name after selecting window in focus-in-hook (so
append it to the hook, after doom-modeline-set-selected-window).
See #133 and #114#issuecomment-469060334.
This commit is contained in:
Vincent Zhang 2019-03-16 01:20:31 +07:00
parent fb8220d47e
commit b29e5a85e9
3 changed files with 11 additions and 6 deletions

View file

@ -398,7 +398,7 @@ If DEFAULT is non-nil, set the default mode-line for all buffers."
(advice-add #'delete-frame :after #'doom-modeline-set-selected-window) (advice-add #'delete-frame :after #'doom-modeline-set-selected-window)
(with-no-warnings (with-no-warnings
(cond ((not (boundp 'after-focus-change-function)) (cond ((not (boundp 'after-focus-change-function))
(add-hook 'focus-in-hook #'doom-modeline-set-selected-window) (add-hook 'focus-in-hook #'doom-modeline-set-selected-window)
(add-hook 'focus-out-hook #'doom-modeline-unset-selected-window)) (add-hook 'focus-out-hook #'doom-modeline-unset-selected-window))
((defun doom-modeline-refresh-frame () ((defun doom-modeline-refresh-frame ()
(setq doom-modeline-current-window nil) (setq doom-modeline-current-window nil)

View file

@ -322,9 +322,14 @@ mouse-1: Previous buffer\nmouse-3: Next buffer"
(advice-add #'symbol-overlay-rename :after #'doom-modeline-update-buffer-file-name) (advice-add #'symbol-overlay-rename :after #'doom-modeline-update-buffer-file-name)
(advice-add #'popup-create :after #'doom-modeline-update-buffer-file-name) (advice-add #'popup-create :after #'doom-modeline-update-buffer-file-name)
(advice-add #'popup-delete :after #'doom-modeline-update-buffer-file-name) (advice-add #'popup-delete :after #'doom-modeline-update-buffer-file-name)
(advice-add #'doom-modeline-set-selected-window :after #'doom-modeline-update-buffer-file-name)
(if (fboundp 'doom-modeline-refresh-frame) (with-no-warnings
(advice-add #'doom-modeline-refresh-frame :after #'doom-modeline-update-buffer-file-name)) (if (boundp 'after-focus-change-function)
(add-function :after after-focus-change-function
(lambda ()
(when (frame-focus-state)
(doom-modeline-update-buffer-file-name))))
(add-hook 'focus-in-hook #'doom-modeline-update-buffer-file-name t)))
(when (>= emacs-major-version 26) (when (>= emacs-major-version 26)
(add-variable-watcher (add-variable-watcher
@ -1320,9 +1325,9 @@ mouse-2: Show help for minor mode"
" ")))))) " "))))))
(add-hook 'find-file-hook #'doom-modeline-update-persp-name) (add-hook 'find-file-hook #'doom-modeline-update-persp-name)
(add-hook 'buffer-list-update-hook #'doom-modeline-update-persp-name)
(add-hook 'persp-activated-functions #'doom-modeline-update-persp-name) (add-hook 'persp-activated-functions #'doom-modeline-update-persp-name)
(add-hook 'persp-renamed-functions #'doom-modeline-update-persp-name) (add-hook 'persp-renamed-functions #'doom-modeline-update-persp-name)
(advice-add #'doom-modeline-set-selected-window :after #'doom-modeline-update-persp-name)
(doom-modeline-def-segment persp-name (doom-modeline-def-segment persp-name
"The current perspective name." "The current perspective name."

View file

@ -4,7 +4,7 @@
;; Author: Vincent Zhang <seagle0128@gmail.com> ;; Author: Vincent Zhang <seagle0128@gmail.com>
;; Homepage: https://github.com/seagle0128/doom-modeline ;; Homepage: https://github.com/seagle0128/doom-modeline
;; Version: 1.9.1 ;; Version: 1.9.2
;; Package-Requires: ((emacs "25.1") (all-the-icons "1.0.0") (shrink-path "0.2.0") (eldoc-eval "0.1") (dash "2.11.0")) ;; Package-Requires: ((emacs "25.1") (all-the-icons "1.0.0") (shrink-path "0.2.0") (eldoc-eval "0.1") (dash "2.11.0"))
;; Keywords: faces mode-line ;; Keywords: faces mode-line