* mood-line.el: Changed mode-line segment control flow
I realized while doing other things that I had convoluted the the generation of the modeline needlessly with my modal implementation. By moving my modal tests into a cond form and simply shuffling `mode-line-segment-modified', we get a cleaner, simpler implementation.
This commit is contained in:
parent
fe26101881
commit
f94b098b34
18
mood-line.el
18
mood-line.el
@ -348,10 +348,10 @@ The `Face' may be either a face symbol or a property list of key-value pairs
|
|||||||
mood-line-meow-state-alist)))
|
mood-line-meow-state-alist)))
|
||||||
(concat (propertize (car mode-cons) 'face (cdr mode-cons)) " "))))
|
(concat (propertize (car mode-cons) 'face (cdr mode-cons)) " "))))
|
||||||
|
|
||||||
(defun mood-line--modal-editing-p ()
|
(defun mood-line-segment-modal ()
|
||||||
"Determine if modal editing is being used."
|
"Call the correct mode-line segment when the first modal-mode is found."
|
||||||
(or (bound-and-true-p evil-mode)
|
(cond ((bound-and-true-p evil-mode) (mood-line-segment-evil))
|
||||||
(bound-and-true-p meow-mode)))
|
((bound-and-true-p meow-mode) (mood-line-segment-meow))))
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Activation function
|
;; Activation function
|
||||||
@ -393,15 +393,9 @@ The `Face' may be either a face symbol or a property list of key-value pairs
|
|||||||
;; Left
|
;; Left
|
||||||
(format-mode-line
|
(format-mode-line
|
||||||
'(" "
|
'(" "
|
||||||
(:eval (if (mood-line--modal-editing-p)
|
(:eval (mood-line-segment-modal))
|
||||||
(progn
|
(:eval (mood-line-segment-modified))
|
||||||
(mood-line-segment-evil)
|
|
||||||
(mood-line-segment-meow))
|
|
||||||
(mood-line-segment-modified)))
|
|
||||||
(:eval (mood-line-segment-buffer-name))
|
(:eval (mood-line-segment-buffer-name))
|
||||||
(:eval (if (mood-line--modal-editing-p)
|
|
||||||
(concat
|
|
||||||
(mood-line-segment-modified) " ")))
|
|
||||||
(:eval (mood-line-segment-anzu))
|
(:eval (mood-line-segment-anzu))
|
||||||
(:eval (mood-line-segment-multiple-cursors))
|
(:eval (mood-line-segment-multiple-cursors))
|
||||||
(:eval (mood-line-segment-position))))
|
(:eval (mood-line-segment-position))))
|
||||||
|
Loading…
Reference in New Issue
Block a user