* 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)))
|
||||
(concat (propertize (car mode-cons) 'face (cdr mode-cons)) " "))))
|
||||
|
||||
(defun mood-line--modal-editing-p ()
|
||||
"Determine if modal editing is being used."
|
||||
(or (bound-and-true-p evil-mode)
|
||||
(bound-and-true-p meow-mode)))
|
||||
(defun mood-line-segment-modal ()
|
||||
"Call the correct mode-line segment when the first modal-mode is found."
|
||||
(cond ((bound-and-true-p evil-mode) (mood-line-segment-evil))
|
||||
((bound-and-true-p meow-mode) (mood-line-segment-meow))))
|
||||
|
||||
;;
|
||||
;; Activation function
|
||||
@ -393,15 +393,9 @@ The `Face' may be either a face symbol or a property list of key-value pairs
|
||||
;; Left
|
||||
(format-mode-line
|
||||
'(" "
|
||||
(:eval (if (mood-line--modal-editing-p)
|
||||
(progn
|
||||
(mood-line-segment-evil)
|
||||
(mood-line-segment-meow))
|
||||
(mood-line-segment-modified)))
|
||||
(:eval (mood-line-segment-modal))
|
||||
(:eval (mood-line-segment-modified))
|
||||
(: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-multiple-cursors))
|
||||
(:eval (mood-line-segment-position))))
|
||||
|
Loading…
Reference in New Issue
Block a user