Fix #313: Frame focus error.

doom-modeline-focus-change: Symbol’s function definition is void:
frame-focus-state.

`after-focus-change-function' and `frame-focus-state are introduced' in 27.
This commit is contained in:
Vincent Zhang 2020-02-19 23:51:40 +08:00
parent 4ee3559fb6
commit 333dc074e5

View file

@ -777,15 +777,15 @@ then this function does nothing."
(setq doom-modeline-remap-face-cookie
(face-remap-add-relative 'mode-line 'mode-line-inactive)))
(defun doom-modeline-focus-change (&rest _)
(if (frame-focus-state)
(doom-modeline-focus)
(doom-modeline-unfocus)))
(advice-add #'handle-switch-frame :after #'doom-modeline-focus-change)
(with-no-warnings
(if (boundp 'after-focus-change-function)
(add-function :after after-focus-change-function #'doom-modeline-focus-change)
(progn
(defun doom-modeline-focus-change (&rest _)
(if (frame-focus-state)
(doom-modeline-focus)
(doom-modeline-unfocus)))
(advice-add #'handle-switch-frame :after #'doom-modeline-focus-change)
(add-function :after after-focus-change-function #'doom-modeline-focus-change))
(progn
(add-hook 'focus-in-hook #'doom-modeline-focus)
(add-hook 'focus-out-hook #'doom-modeline-unfocus))))