Merge pull request #3307 from ericdallo/add-lsp-modeline

Add lsp and repl to +light modeline
This commit is contained in:
Henrik Lissner 2021-05-15 17:54:53 -04:00 committed by GitHub
commit 7383ed4dc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 14 deletions

View file

@ -109,14 +109,22 @@ side of the modeline, and whose CDR is the right-hand side.")
(if (eq idx len) "\"};" "\",\n")))))
'xpm t :ascent 'center)))))
(defun +modeline-format-icon (icon label &optional face help-echo voffset)
(propertize (concat (all-the-icons-material
icon
:face face
:height 1.1
:v-adjust (or voffset -0.225))
(propertize label 'face face))
'help-echo help-echo))
(defun +modeline-format-icon (icon-set icon label &optional face help-echo voffset)
"Build from ICON-SET the ICON with LABEL.
Using optionals attributes FACE, HELP-ECHO and VOFFSET."
(let ((icon-set-fn (pcase icon-set
('octicon #'all-the-icons-octicon)
('faicon #'all-the-icons-faicon)
('material #'all-the-icons-material)
('alltheicon #'all-the-icons-alltheicon)
('fileicon #'all-the-icons-fileicon))))
(propertize (concat (funcall icon-set-fn
icon
:face face
:height 1.1
:v-adjust (or voffset -0.225))
(propertize label 'face face))
'help-echo help-echo)))
(defun set-modeline! (name &optional default)
"Set the modeline to NAME.
@ -410,7 +418,7 @@ Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with
(let ((error (or .error 0))
(warning (or .warning 0))
(info (or .info 0)))
(+modeline-format-icon "do_not_disturb_alt"
(+modeline-format-icon 'material "do_not_disturb_alt"
(number-to-string (+ error warning info))
(cond ((> error 0) 'error)
((> warning 0) 'warning)
@ -420,10 +428,11 @@ Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with
warning
info))))
(+modeline-format-icon "check" "" 'success)))
(`running (+modeline-format-icon "access_time" "*" 'mode-line-inactive "Running..."))
(`errored (+modeline-format-icon "sim_card_alert" "!" 'error "Errored!"))
(`interrupted (+modeline-format-icon "pause" "!" 'mode-line-inactive "Interrupted"))
(`suspicious (+modeline-format-icon "priority_high" "!" 'error "Suspicious"))))))
(`running (+modeline-format-icon'material "access_time" "*" 'mode-line-inactive "Running..."))
(`errored (+modeline-format-icon'material "sim_card_alert" "!" 'error "Errored!"))
(`interrupted (+modeline-format-icon'material "pause" "!" 'mode-line-inactive "Interrupted"))
(`suspicious (+modeline-format-icon'material "priority_high" "!" 'error "Suspicious"))))))
;;; `+modeline-selection-info'