Compare commits

..

11 Commits
3.1.0 ... main

9 changed files with 47 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

View File

@ -2,7 +2,7 @@
;; ;;
;; Author: Jessie Hildebrandt <jessieh.net> ;; Author: Jessie Hildebrandt <jessieh.net>
;; Homepage: https://gitlab.com/jessieh/mood-line ;; Homepage: https://gitlab.com/jessieh/mood-line
;;
;; This file is not part of GNU Emacs. ;; This file is not part of GNU Emacs.
;;; Commentary: ;;; Commentary:

View File

@ -3,7 +3,7 @@
;; Author: Alynx Zhou <alynx.zhou@gmail.com> ;; Author: Alynx Zhou <alynx.zhou@gmail.com>
;; Jessie Hildebrandt <jessieh.net> ;; Jessie Hildebrandt <jessieh.net>
;; Homepage: https://gitlab.com/jessieh/mood-line ;; Homepage: https://gitlab.com/jessieh/mood-line
;;
;; This file is not part of GNU Emacs. ;; This file is not part of GNU Emacs.
;;; Commentary: ;;; Commentary:

View File

@ -3,7 +3,7 @@
;; Author: trevDev() <trev@trevdev.ca> ;; Author: trevDev() <trev@trevdev.ca>
;; Jessie Hildebrandt <jessieh.net> ;; Jessie Hildebrandt <jessieh.net>
;; Homepage: https://gitlab.com/jessieh/mood-line ;; Homepage: https://gitlab.com/jessieh/mood-line
;;
;; This file is not part of GNU Emacs. ;; This file is not part of GNU Emacs.
;;; Commentary: ;;; Commentary:
@ -107,6 +107,16 @@ e.g., (:foreground \"red\")."
(concat (propertize (car mode-cons) (concat (propertize (car mode-cons)
'face (cdr mode-cons)))))) 'face (cdr mode-cons))))))
;; ---------------------------------- ;;
;; Xah segment
;; ---------------------------------- ;;
(defun mood-line-segment-modal--xah-fn ()
"Display the current xah-fly-keys state."
(if (bound-and-true-p xah-fly-insert-state-p)
"<I>"
"<C>"))
;; ---------------------------------- ;; ;; ---------------------------------- ;;
;; God segment ;; God segment
;; ---------------------------------- ;; ;; ---------------------------------- ;;

View File

@ -2,7 +2,7 @@
;; ;;
;; Author: Jessie Hildebrandt <jessieh.net> ;; Author: Jessie Hildebrandt <jessieh.net>
;; Homepage: https://gitlab.com/jessieh/mood-line ;; Homepage: https://gitlab.com/jessieh/mood-line
;;
;; This file is not part of GNU Emacs. ;; This file is not part of GNU Emacs.
;;; Commentary: ;;; Commentary:

View File

@ -220,6 +220,7 @@ An optional key :padding may be provided, the value of which will be used as
((or (mood-line-segment-buffer-status) ((or (mood-line-segment-buffer-status)
(mood-line-segment-client) (mood-line-segment-client)
" ") . " ") " ") . " ")
((mood-line-segment-project) . "/")
((mood-line-segment-buffer-name) . " ") ((mood-line-segment-buffer-name) . " ")
((mood-line-segment-anzu) . " ") ((mood-line-segment-anzu) . " ")
((mood-line-segment-multiple-cursors) . " ") ((mood-line-segment-multiple-cursors) . " ")
@ -355,7 +356,7 @@ See `mood-line-defformat' for a helpful formatting macro."
:group 'mood-line-faces) :group 'mood-line-faces)
(defface mood-line-frame-status-client (defface mood-line-frame-status-client
'((t (:inherit shadow :weight normal))) '((t (:inherit mood-line-unimportant)))
"Face used for the :frame-client frame status indicator.") "Face used for the :frame-client frame status indicator.")
(defface mood-line-major-mode (defface mood-line-major-mode
@ -460,17 +461,22 @@ described in the documentation for `mood-line-format', which see."
(mood-line--deflazy mood-line-segment-modal--evil-fn) (mood-line--deflazy mood-line-segment-modal--evil-fn)
(mood-line--deflazy mood-line-segment-modal--meow-fn) (mood-line--deflazy mood-line-segment-modal--meow-fn)
(mood-line--deflazy mood-line-segment-modal--xah-fn)
(mood-line--deflazy mood-line-segment-modal--god-fn) (mood-line--deflazy mood-line-segment-modal--god-fn)
(defun mood-line-segment-modal () (defun mood-line-segment-modal ()
"Return the correct mode line segment for the first active modal mode found. "Return the correct mode line segment for the first active modal mode found.
Modal modes checked, in order: `evil-mode', `meow-mode', `god-mode'." Modal editing modes checked, in order:
`evil-mode', `meow-mode', `xah-fly-keys', `god-mode'"
(cond (cond
((bound-and-true-p evil-mode) ((bound-and-true-p evil-mode)
(mood-line-segment-modal--evil-fn)) (mood-line-segment-modal--evil-fn))
((bound-and-true-p meow-mode) ((bound-and-true-p meow-mode)
(mood-line-segment-modal--meow-fn)) (mood-line-segment-modal--meow-fn))
((featurep 'god-mode) ((bound-and-true-p xah-fly-keys)
(mood-line-segment-modal--xah-fn))
((or (bound-and-true-p god-local-mode)
(bound-and-true-p god-global-mode))
(mood-line-segment-modal--god-fn)))) (mood-line-segment-modal--god-fn))))
;; ---------------------------------- ;; ;; ---------------------------------- ;;
@ -521,6 +527,21 @@ Modal modes checked, in order: `evil-mode', `meow-mode', `god-mode'."
(propertize (mood-line--get-glyph :frame-client) (propertize (mood-line--get-glyph :frame-client)
'face 'mood-line-frame-status-client))) 'face 'mood-line-frame-status-client)))
;; -------------------------------------------------------------------------- ;;
;;
;; Project segment
;;
;; -------------------------------------------------------------------------- ;;
(defun mood-line-segment-project ()
"Return project name from project.el or Projectile, if any."
(or
(and (fboundp 'project-name)
(project-current)
(project-name (project-current)))
(and (fboundp 'projectile-project-name)
(projectile-project-name))))
;; -------------------------------------------------------------------------- ;; ;; -------------------------------------------------------------------------- ;;
;; ;;
;; anzu segment ;; anzu segment

View File

@ -34,4 +34,12 @@
(should (string= (mood-line-segment-vc--rev "" 'SVN) (should (string= (mood-line-segment-vc--rev "" 'SVN)
"???")))) "???"))))
(ert-deftest --rev/vc-display-status-nil ()
"Name of the VCS backend should be reported when `vc-display-status' is nil."
(let ((vc-display-status nil))
(should (string= (mood-line-segment-vc--rev " Git:main" 'Git)
"Git"))
(should (string= (mood-line-segment-vc--rev " Hg:main" 'Hg)
"Hg"))))
;;; mood-line-segment-vc-test.el ends here ;;; mood-line-segment-vc-test.el ends here

View File

@ -148,7 +148,7 @@
(should (string= segments-str "ABC123XYZ")))) (should (string= segments-str "ABC123XYZ"))))
;; ---------------------------------- ;; ;; ---------------------------------- ;;
;; mood-line---process-format ;; mood-line--process-format
;; ---------------------------------- ;; ;; ---------------------------------- ;;
(ert-deftest --process-format/default () (ert-deftest --process-format/default ()