From a6d8a0b4ec328251c31cb96bf90d0e93c9def102 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 26 Apr 2018 02:00:21 -0400 Subject: [PATCH] ui/doom-modeline: update flycheck on status-changed #549 --- modules/ui/doom-modeline/config.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ui/doom-modeline/config.el b/modules/ui/doom-modeline/config.el index bc22266f0..a26f72136 100644 --- a/modules/ui/doom-modeline/config.el +++ b/modules/ui/doom-modeline/config.el @@ -426,10 +426,10 @@ directory, the file name, and its state (modified, read-only or non-existent)." (if vc-mode " " " "))) (defvar-local +doom-modeline--flycheck nil) -(add-hook 'flycheck-after-syntax-check-hook #'+doom-modeline|update-flycheck-segment) -(defun +doom-modeline|update-flycheck-segment () +(add-hook 'flycheck-status-changed-functions #'+doom-modeline|update-flycheck-segment) +(defun +doom-modeline|update-flycheck-segment (status) (setq +doom-modeline--flycheck - (pcase flycheck-last-status-change + (pcase status ('finished (if flycheck-current-errors (let-alist (flycheck-count-errors flycheck-current-errors) (let ((sum (+ (or .error 0) (or .warning 0)))) @@ -446,7 +446,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." - +doom-modeline--flycheck) + (if (bound-and-true-p flycheck-mode) +doom-modeline--flycheck)) ;;