summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franckcuny@gmail.com>2016-05-24 20:07:45 -0700
committerFranck Cuny <franckcuny@gmail.com>2016-05-24 20:07:45 -0700
commit42d5d8c36013d9b8c64a22edd69ca42a021ba77e (patch)
tree1602017f3acc03c464163121f3a2774f940d4a50
parent[emacs] open magit in full screen. (diff)
downloademacs.d-42d5d8c36013d9b8c64a22edd69ca42a021ba77e.tar.gz
[emacs] Change mode line for flycheck.
Display a unicode symbol to represent the status of the tests.
-rw-r--r--emacs.d/core/core-flycheck.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/emacs.d/core/core-flycheck.el b/emacs.d/core/core-flycheck.el
index 7118f83..ab33887 100644
--- a/emacs.d/core/core-flycheck.el
+++ b/emacs.d/core/core-flycheck.el
@@ -12,6 +12,25 @@
     (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)))
   :config
   (progn
+    (setq flycheck-mode-line
+      '(:eval
+        (pcase flycheck-last-status-change
+          (`not-checked nil)
+          (`no-checker (propertize " -" 'face 'warning))
+          (`running "")
+          (`errored (propertize " ✘" 'face 'error))
+          (`finished
+           (if flycheck-current-errors
+               (let* ((error-counts (flycheck-count-errors flycheck-current-errors))
+                      (no-errors (cdr (assq 'error error-counts)))
+                      (no-warnings (cdr (assq 'warning error-counts)))
+                      (flycheck-face (cond (no-errors 'error)
+                                           (no-warnings 'warning))))
+                 (propertize (format " [✗:%s/%s]" (or no-errors 0) (or no-warnings 0)) 'face flycheck-face))
+             (propertize " [✓]" 'face 'success)))
+          (`interrupted " -")
+          (`suspicious '(propertize " ?" 'face 'warning)))))
+
     (flycheck-define-checker source-check
       "A syntax checker for python source code in Source, using `check.pex'"
       :command ("check.pex" source)