From 630188e27e04449eb27bd9dec27630b26a5f0d13 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 26 Apr 2018 04:56:30 -0400 Subject: [PATCH] ui/doom-modeline: optimize flycheck segment --- modules/ui/doom-modeline/config.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ui/doom-modeline/config.el b/modules/ui/doom-modeline/config.el index a26f72136..42e5758ae 100644 --- a/modules/ui/doom-modeline/config.el +++ b/modules/ui/doom-modeline/config.el @@ -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) ;;