ui/doom-modeline: optimize flycheck segment

This commit is contained in:
Henrik Lissner 2018-04-26 04:56:30 -04:00
parent a6d8a0b4ec
commit 630188e27e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -427,7 +427,8 @@ directory, the file name, and its state (modified, read-only or non-existent)."
(defvar-local +doom-modeline--flycheck nil)
(add-hook 'flycheck-status-changed-functions #'+doom-modeline|update-flycheck-segment)
(defun +doom-modeline|update-flycheck-segment (status)
(add-hook 'flycheck-mode-hook #'+doom-modeline|update-flycheck-segment)
(defun +doom-modeline|update-flycheck-segment (&optional status)
(setq +doom-modeline--flycheck
(pcase status
('finished (if flycheck-current-errors
@ -446,7 +447,7 @@ directory, the file name, and its state (modified, read-only or non-existent)."
(def-modeline-segment! flycheck
"Displays color-coded flycheck error status in the current buffer with pretty
icons."
(if (bound-and-true-p flycheck-mode) +doom-modeline--flycheck))
+doom-modeline--flycheck)
;;