* mood-line.el: Added meow-edit support

This commit is contained in:
Trevor Richards 2022-07-29 10:54:04 -07:00
parent 855ea2760e
commit fe26101881
No known key found for this signature in database
GPG Key ID: 8546CF84A13DD5EF

View File

@ -104,6 +104,21 @@ The `Face' may be either a face symbol or a property list of key-value pairs
:value-type
(cons (string :tag "Display Text") (choice :tag "Face" face plist))))
(defcustom mood-line-meow-state-alist
'((normal . ("<N>" . font-lock-variable-name-face))
(insert . ("<I>" . font-lock-string-face))
(keypad . ("<K>" . font-lock-keyword-face))
(beacon . ("<B>" . font-lock-type-face))
(motion . ("<M>" . font-lock-constant-face)))
"Set the string and corresponding face for any `meow-mode' state.
The `Face' may be either a face symbol or a property list of key-value pairs
e.g. (:foreground \"red\")."
:group 'mood-line
:type '(alist
:key-type symbol
:value-type
(cons (string :tag "Display Text") (choice :tag "Face" face plist))))
(defface mood-line-buffer-name
'((t (:inherit (mode-line-buffer-id))))
"Face used for major mode indicator in the mode-line."
@ -326,9 +341,17 @@ The `Face' may be either a face symbol or a property list of key-value pairs
(let ((mode-cons (alist-get evil-state mood-line-evil-state-alist)))
(concat (propertize (car mode-cons) 'face (cdr mode-cons)) " "))))
(defun mood-line-segment-meow ()
(when meow--current-state
(let ((mode-cons (alist-get
meow--current-state
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))) ; (or) is for future modal additions.
(or (bound-and-true-p evil-mode)
(bound-and-true-p meow-mode)))
;;
;; Activation function
@ -372,7 +395,8 @@ The `Face' may be either a face symbol or a property list of key-value pairs
'(" "
(:eval (if (mood-line--modal-editing-p)
(progn
(mood-line-segment-evil))
(mood-line-segment-evil)
(mood-line-segment-meow))
(mood-line-segment-modified)))
(:eval (mood-line-segment-buffer-name))
(:eval (if (mood-line--modal-editing-p)