branch: elpa/telephone-line
commit 17bc3be4bf2307f2cbe0e7d6583e8607727de553
Merge: 2fd44a2811 c9aca6ce03
Author: Daniel Bordak <[email protected]>
Commit: Daniel Bordak <[email protected]>
Merge branch 'master' of github.com:dbordak/telephone-line
---
telephone-line-segments.el | 36 +++++++++++++++++++++++++++++++++---
telephone-line.el | 3 ++-
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/telephone-line-segments.el b/telephone-line-segments.el
index 1091b56088..923dbcbe74 100644
--- a/telephone-line-segments.el
+++ b/telephone-line-segments.el
@@ -143,9 +143,8 @@ If it doesn't exist, create and cache it."
(winum-get-number-string))))
(telephone-line-defsegment telephone-line-projectile-segment ()
- (if (and (fboundp 'projectile-project-name)
- (projectile-project-name))
- (propertize (format "[%s]" (concat (projectile-project-name)))
+ (if (fboundp 'projectile-project-name)
+ (propertize (projectile-project-name)
'face '(:inherit)
'display '(raise 0.0)
'help-echo "Switch project"
@@ -168,6 +167,37 @@ If it doesn't exist, create and cache it."
(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."