Add info count to flycheck indicators
This commit is contained in:
parent
8ea891aeb5
commit
7619a1b0d2
1 changed files with 21 additions and 13 deletions
|
@ -24,18 +24,26 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(smt/defwidget my-smt-flycheck-errors
|
(require 'svg-mode-line-themes)
|
||||||
:text (lambda (widget)
|
(require 'flycheck)
|
||||||
(ignore widget)
|
(require 'cl)
|
||||||
(when flycheck-mode
|
|
||||||
(let ((counts (flycheck-count-errors
|
(defun oni-smt-flycheck-errors-text (_)
|
||||||
flycheck-current-errors)))
|
"Show an indicator of the number of errors and warnings from flycheck."
|
||||||
`(tspan " " (tspan :fill ,(if (smt/window-active-p)
|
(when flycheck-mode
|
||||||
"#a85454"
|
(let* ((counts (flycheck-count-errors flycheck-current-errors))
|
||||||
"#969696") ,(or (cdr (assoc 'error counts)) 0))
|
(err-color (if (smt/window-active-p) "#a85454" "#969696"))
|
||||||
"/" (tspan :fill ,(if (smt/window-active-p)
|
(warn-color (if (smt/window-active-p) "#a88654" "#969696"))
|
||||||
"#a88654"
|
(info-color (if (smt/window-active-p) "#5476a8" "#969696"))
|
||||||
"#969696") ,(or (cdr (assoc 'warning counts)) 0)))))))
|
(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
|
(smt/defwidget my-smt-jabber-activity
|
||||||
:text (lambda (widget)
|
:text (lambda (widget)
|
||||||
|
@ -135,7 +143,7 @@ WIDGET is ignored."
|
||||||
:widgets '(my-smt-jabber-activity
|
:widgets '(my-smt-jabber-activity
|
||||||
major-mode
|
major-mode
|
||||||
my-smt-current-dictionary
|
my-smt-current-dictionary
|
||||||
my-smt-flycheck-errors
|
oni-smt-flycheck-errors
|
||||||
version-control minor-modes)
|
version-control minor-modes)
|
||||||
:margin 16)
|
:margin 16)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue