From b29e5a85e92fbf072e34acc96fb5b77f701cbf2e Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Sat, 16 Mar 2019 01:20:31 +0700 Subject: [PATCH] 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. --- doom-modeline-core.el | 2 +- doom-modeline-segments.el | 13 +++++++++---- doom-modeline.el | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doom-modeline-core.el b/doom-modeline-core.el index 68a30f1..bf225a4 100644 --- a/doom-modeline-core.el +++ b/doom-modeline-core.el @@ -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) (with-no-warnings (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)) ((defun doom-modeline-refresh-frame () (setq doom-modeline-current-window nil) diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index 2e942f5..65c61d7 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -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 #'popup-create :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) - (advice-add #'doom-modeline-refresh-frame :after #'doom-modeline-update-buffer-file-name)) + +(with-no-warnings + (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) (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 'buffer-list-update-hook #'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) -(advice-add #'doom-modeline-set-selected-window :after #'doom-modeline-update-persp-name) (doom-modeline-def-segment persp-name "The current perspective name." diff --git a/doom-modeline.el b/doom-modeline.el index e2e01c7..7c54527 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -4,7 +4,7 @@ ;; Author: Vincent Zhang ;; 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")) ;; Keywords: faces mode-line