summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2015-04-27 12:08:14 +0200
committerGravatar Tom Willemse2015-04-27 12:08:14 +0200
commit7619a1b0d2e3b42f31739413ebf28f33d59b6bc4 (patch)
tree6b537f77d04a58268a9028eabaa0174578c7783c
parent8ea891aeb512e0371884af850a2a70c43c079d9b (diff)
downloaddotfiles-7619a1b0d2e3b42f31739413ebf28f33d59b6bc4.tar.gz
dotfiles-7619a1b0d2e3b42f31739413ebf28f33d59b6bc4.zip
Add info count to flycheck indicators
-rw-r--r--emacs/.emacs.d/site-lisp/my-smt.el34
1 files changed, 21 insertions, 13 deletions
diff --git a/emacs/.emacs.d/site-lisp/my-smt.el b/emacs/.emacs.d/site-lisp/my-smt.el
index 5d81091..4c4f6ee 100644
--- a/emacs/.emacs.d/site-lisp/my-smt.el
+++ b/emacs/.emacs.d/site-lisp/my-smt.el
@@ -24,18 +24,26 @@
;;; Code:
-(smt/defwidget my-smt-flycheck-errors
- :text (lambda (widget)
- (ignore widget)
- (when flycheck-mode
- (let ((counts (flycheck-count-errors
- flycheck-current-errors)))
- `(tspan " " (tspan :fill ,(if (smt/window-active-p)
- "#a85454"
- "#969696") ,(or (cdr (assoc 'error counts)) 0))
- "/" (tspan :fill ,(if (smt/window-active-p)
- "#a88654"
- "#969696") ,(or (cdr (assoc 'warning counts)) 0)))))))
+(require 'svg-mode-line-themes)
+(require 'flycheck)
+(require 'cl)
+
+(defun oni-smt-flycheck-errors-text (_)
+ "Show an indicator of the number of errors and warnings from flycheck."
+ (when flycheck-mode
+ (let* ((counts (flycheck-count-errors flycheck-current-errors))
+ (err-color (if (smt/window-active-p) "#a85454" "#969696"))
+ (warn-color (if (smt/window-active-p) "#a88654" "#969696"))
+ (info-color (if (smt/window-active-p) "#5476a8" "#969696"))
+ (err-count (alist-get 'error counts 0))
+ (warn-count (alist-get 'warning counts 0))
+ (info-count (alist-get 'info counts 0)))
+ `(tspan " " (tspan :fill ,err-color ,err-count)
+ "/" (tspan :fill ,warn-color ,warn-count)
+ "/" (tspan :fill ,info-color ,info-count)))))
+
+(smt/defwidget oni-smt-flycheck-errors
+ :text #'oni-smt-flycheck-errors-text)
(smt/defwidget my-smt-jabber-activity
:text (lambda (widget)
@@ -135,7 +143,7 @@ WIDGET is ignored."
:widgets '(my-smt-jabber-activity
major-mode
my-smt-current-dictionary
- my-smt-flycheck-errors
+ oni-smt-flycheck-errors
version-control minor-modes)
:margin 16)