branch: elpa/telephone-line
commit c9aca6ce030fac893793558c74a957e7bd0e6034
Author: Daniel Bordak <[email protected]>
Commit: Daniel Bordak <[email protected]>
Add flycheck segment
---
telephone-line-segments.el | 31 +++++++++++++++++++++++++++++++
telephone-line.el | 3 ++-
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/telephone-line-segments.el b/telephone-line-segments.el
index 2ccef11c6f..da4c072c69 100644
--- a/telephone-line-segments.el
+++ b/telephone-line-segments.el
@@ -129,6 +129,37 @@ mouse-3: Toggle minor modes"
(seq-take tag 2)
tag))))
+(telephone-line-defsegment telephone-line-flycheck-segment ()
+ (when (bound-and-true-p flycheck-mode)
+ (let* ((text (pcase flycheck-last-status-change
+ ('finished (if flycheck-current-errors
+ (let-alist (flycheck-count-errors
flycheck-current-errors)
+ (if (or .error .warning)
+ (propertize (format "Problems: %s/%s"
+ (or .error 0) (or
.warning 0))
+ 'face '(:foreground
"orange"))
+ ""))
+ ":)"))
+ ('running "*")
+ ('no-checker "-")
+ ('not-checked "=")
+ ('errored (propertize "!" 'face '(:foreground
"tomato")))
+ ('interrupted (propertize "." 'face '(:foreground
"tomato")))
+ ('suspicious "?"))))
+ (propertize text
+ 'help-echo (pcase flycheck-last-status-change
+ ('finished "Display errors found by Flycheck")
+ ('running "Running...")
+ ('no-checker "No Checker")
+ ('not-checked "Not Checked")
+ ('errored "Error!")
+ ('interrupted "Interrupted")
+ ('suspicious "Suspicious?"))
+ 'display '(raise 0.0)
+ 'mouse-face '(:box 1)
+ 'local-map (make-mode-line-mouse-map
+ 'mouse-1 #'flycheck-list-errors)))))
+
(telephone-line-defsegment* telephone-line-xah-fly-keys-segment ()
(when (boundp xah-fly-insert-state-q)
(let ((tag (if xah-fly-insert-state-q
diff --git a/telephone-line.el b/telephone-line.el
index 063374779a..e4ef34d8aa 100644
--- a/telephone-line.el
+++ b/telephone-line.el
@@ -329,7 +329,8 @@ separators, as they are conditional, are evaluated
on-the-fly."
:group 'telephone-line)
(defcustom telephone-line-rhs
- '((nil . (telephone-line-misc-info-segment))
+ '((nil . (telephone-line-flycheck-segment
+ telephone-line-misc-info-segment))
(accent . (telephone-line-major-mode-segment))
(evil . (telephone-line-airline-position-segment)))
"Right hand side segment alist."