ui/doom-modeline: refactor flycheck segment (faster)

This commit is contained in:
Henrik Lissner 2018-01-31 04:24:51 -05:00
parent 50ce083696
commit c52cb38385
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -419,10 +419,10 @@ directory, the file name, and its state (modified, read-only or non-existent)."
(propertize text 'face face))
(if vc-mode " " " ")))
(def-modeline-segment! flycheck
"Displays color-coded flycheck error status in the current buffer with pretty
icons."
(when (boundp 'flycheck-last-status-change)
(defvar-local +doom-modeline--flycheck nil)
(add-hook 'flycheck-after-syntax-check-hook #'+doom-modeline|update-flycheck-segment)
(defun +doom-modeline|update-flycheck-segment ()
(setq +doom-modeline--flycheck
(pcase flycheck-last-status-change
('finished (if flycheck-current-errors
(let-alist (flycheck-count-errors flycheck-current-errors)
@ -436,7 +436,11 @@ icons."
('no-checker (+doom-ml-icon "sim_card_alert" "-" 'font-lock-doc-face))
('errored (+doom-ml-icon "sim_card_alert" "Error" 'doom-modeline-urgent))
('interrupted (+doom-ml-icon "pause" "Interrupted" 'font-lock-doc-face)))))
;; ('interrupted (+doom-ml-icon "x" "Interrupted" 'font-lock-doc-face)))))
(def-modeline-segment! flycheck
"Displays color-coded flycheck error status in the current buffer with pretty
icons."
+doom-modeline--flycheck)
;;
(defsubst doom-column (pos)