Update env only while focusing in. For Emacs27+.

This commit is contained in:
Vincent Zhang 2019-01-10 16:40:47 +08:00
parent c7d54f24d0
commit aad3026ce8

View file

@ -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."