From af3eb37c8e51084261f2ad4bfe1d36fffbcfaebf Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 8 Jun 2022 17:59:53 -0500 Subject: blep --- lisp/+modeline.el | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'lisp/+modeline.el') diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 026302b..11d6a4c 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el @@ -347,7 +347,7 @@ The order of elements matters: whichever one matches first is applied." (defun +modeline-line (&optional spacer) (when line-number-mode (+modeline-spacer nil spacer - "%l"))) + "%3l"))) (defun +modeline-column (&optional spacer) (when column-number-mode @@ -367,8 +367,8 @@ See `line-number-mode', `column-number-mode', and `file-percentage-mode'. If `+modeline-position-function' is set to a function in the current buffer, call that function instead." (cond ((functionp +modeline-position-function) - (+modeline-spacer nil spacer - (funcall +modeline-position-function))) + (when-let* ((str (funcall +modeline-position-function))) + (+modeline-spacer nil spacer str))) (t (funcall (+modeline-concat '(+modeline-region +modeline-line +modeline-column @@ -378,10 +378,9 @@ to a function in the current buffer, call that function instead." (defun +modeline-vc (&optional spacer) "Display the version control branch of the current buffer in the modeline." ;; from https://www.gonsie.com/blorg/modeline.html, from Doom - (if-let ((backend (vc-backend buffer-file-name))) + (when-let ((backend (vc-backend buffer-file-name))) (+modeline-spacer nil spacer - (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))) - "")) + (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))))) (defun +modeline-track (&optional spacer) "Display `tracking-mode' information." @@ -473,13 +472,16 @@ to a function in the current buffer, call that function instead." (kmacro-end-macro nil))))) 'mouse-face 'mode-line-highlight)))) +(defface +nyan-mode-line nil + "Face for nyan-cat in mode line.") + (defun +modeline-nyan-on-focused (&optional spacer) "Display the cat from `nyan-mode', but only on the focused window." (require 'nyan-mode) - (when (actually-selected-window-p) - (concat (or spacer "") (nyan-create) - (propertize "." - 'face 'font-lock-comment-face)))) + (when (and (or nyan-mode (bound-and-true-p +nyan-local-mode)) + (actually-selected-window-p)) + (+modeline-spacer nil spacer + (propertize (nyan-create) 'face '+nyan-mode-line)))) (provide '+modeline) ;;; +modeline.el ends here -- cgit 1.4.1-21-gabe81