summary refs log tree commit diff stats
path: root/lisp/+modeline.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/+modeline.el')
-rw-r--r--lisp/+modeline.el22
1 files changed, 12 insertions, 10 deletions
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."
347(defun +modeline-line (&optional spacer) 347(defun +modeline-line (&optional spacer)
348 (when line-number-mode 348 (when line-number-mode
349 (+modeline-spacer nil spacer 349 (+modeline-spacer nil spacer
350 "%l"))) 350 "%3l")))
351 351
352(defun +modeline-column (&optional spacer) 352(defun +modeline-column (&optional spacer)
353 (when column-number-mode 353 (when column-number-mode
@@ -367,8 +367,8 @@ See `line-number-mode', `column-number-mode', and
367`file-percentage-mode'. If `+modeline-position-function' is set 367`file-percentage-mode'. If `+modeline-position-function' is set
368to a function in the current buffer, call that function instead." 368to a function in the current buffer, call that function instead."
369 (cond ((functionp +modeline-position-function) 369 (cond ((functionp +modeline-position-function)
370 (+modeline-spacer nil spacer 370 (when-let* ((str (funcall +modeline-position-function)))
371 (funcall +modeline-position-function))) 371 (+modeline-spacer nil spacer str)))
372 (t (funcall (+modeline-concat '(+modeline-region 372 (t (funcall (+modeline-concat '(+modeline-region
373 +modeline-line 373 +modeline-line
374 +modeline-column 374 +modeline-column
@@ -378,10 +378,9 @@ to a function in the current buffer, call that function instead."
378(defun +modeline-vc (&optional spacer) 378(defun +modeline-vc (&optional spacer)
379 "Display the version control branch of the current buffer in the modeline." 379 "Display the version control branch of the current buffer in the modeline."
380 ;; from https://www.gonsie.com/blorg/modeline.html, from Doom 380 ;; from https://www.gonsie.com/blorg/modeline.html, from Doom
381 (if-let ((backend (vc-backend buffer-file-name))) 381 (when-let ((backend (vc-backend buffer-file-name)))
382 (+modeline-spacer nil spacer 382 (+modeline-spacer nil spacer
383 (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))) 383 (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2)))))
384 ""))
385 384
386(defun +modeline-track (&optional spacer) 385(defun +modeline-track (&optional spacer)
387 "Display `tracking-mode' information." 386 "Display `tracking-mode' information."
@@ -473,13 +472,16 @@ to a function in the current buffer, call that function instead."
473 (kmacro-end-macro nil))))) 472 (kmacro-end-macro nil)))))
474 'mouse-face 'mode-line-highlight)))) 473 'mouse-face 'mode-line-highlight))))
475 474
475(defface +nyan-mode-line nil
476 "Face for nyan-cat in mode line.")
477
476(defun +modeline-nyan-on-focused (&optional spacer) 478(defun +modeline-nyan-on-focused (&optional spacer)
477 "Display the cat from `nyan-mode', but only on the focused window." 479 "Display the cat from `nyan-mode', but only on the focused window."
478 (require 'nyan-mode) 480 (require 'nyan-mode)
479 (when (actually-selected-window-p) 481 (when (and (or nyan-mode (bound-and-true-p +nyan-local-mode))
480 (concat (or spacer "") (nyan-create) 482 (actually-selected-window-p))
481 (propertize "." 483 (+modeline-spacer nil spacer
482 'face 'font-lock-comment-face)))) 484 (propertize (nyan-create) 'face '+nyan-mode-line))))
483 485
484(provide '+modeline) 486(provide '+modeline)
485;;; +modeline.el ends here 487;;; +modeline.el ends here