From aad3026ce80e7e3106ff131bab3cf4b47f97ee1e Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Thu, 10 Jan 2019 16:40:47 +0800 Subject: [PATCH] Update env only while focusing in. For Emacs27+. --- doom-modeline.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doom-modeline.el b/doom-modeline.el index f534cba..13466a0 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -544,7 +544,10 @@ If DEFAULT is non-nil, set the default mode-line for all buffers." (add-hook 'find-file-hook #'doom-modeline-update-env) (with-no-warnings (if (boundp 'after-focus-change-function) - (add-function :after after-focus-change-function #'doom-modeline-update-env) + (add-function :after after-focus-change-function + (lambda () + (if (frame-focus-state) + (doom-modeline-update-env)))) (add-hook 'focus-in-hook #'doom-modeline-update-env))) (defun doom-modeline-update-env () "Update environment info on mode-line."