From 7d0ff465220bec224c1f0c1163e6b4a88e1fb4c6 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 19 Aug 2022 13:39:13 -0500 Subject: bleh --- lisp/+modeline.el | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'lisp/+modeline.el') diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 11d6a4c..c6e8463 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el @@ -89,14 +89,15 @@ and appended with `truncate-string-ellipsis'." (defun +modeline-buffer-name (&optional spacer) ; gonsie "Display the buffer name." - (let ((bufname (string-trim (string-replace "%" "" (buffer-name))))) + (let ((bufname (string-trim (string-replace "%" "%%%%" (buffer-name))))) (+modeline-spacer nil spacer (if (and +modeline-buffer-position (fboundp +modeline-buffer-position)) (funcall +modeline-buffer-position) (propertize (cond ((ignore-errors - (and (> +modeline-buffer-name-max-length 0) - (< +modeline-buffer-name-max-length 1))) + (and + (> +modeline-buffer-name-max-length 0) + (< +modeline-buffer-name-max-length 1))) (truncate-string-to-width bufname (* (window-total-width) +modeline-buffer-name-max-length) @@ -149,14 +150,14 @@ in the cdr will be applied to the major-mode in the mode line." (propertize ;; (+string-truncate (format-mode-line mode-name) 16) (format-mode-line mode-name) 'face (when (actually-selected-window-p) - ;; XXX: This is probably really inefficient. I need to - ;; simply detect which mode it's in when I change major - ;; modes (`change-major-mode-hook') and change the face - ;; there, probably. - ;; (catch :done (dolist (cel +modeline-major-mode-faces) - ;; (when (derived-mode-p (car cel)) - ;; (throw :done (cdr cel)))) - ;; (alist-get t +modeline-major-mode-faces)) + ;; XXX: This is probably really inefficient. I need to + ;; simply detect which mode it's in when I change major + ;; modes (`change-major-mode-hook') and change the face + ;; there, probably. + ;; (catch :done (dolist (cel +modeline-major-mode-faces) + ;; (when (derived-mode-p (car cel)) + ;; (throw :done (cdr cel)))) + ;; (alist-get t +modeline-major-mode-faces)) '+modeline-major-mode-face) 'keymap (let ((map (make-sparse-keymap))) (bindings--define-key map [mode-line down-mouse-1] @@ -302,13 +303,13 @@ The order of elements matters: whichever one matches first is applied." (when file-percentage-mode (+modeline-spacer nil spacer (let ((perc (format-mode-line '(-2 "%p")))) - (pcase perc - ("To" "/\\") - ("Bo" "\\/") - ("Al" "[]") - (_ (let ((vec (vector "/|" "//" "||" "\\\\" "\\|" "\\|")) - (perc (string-to-number perc))) - (aref vec (floor (/ perc 17)))))))))) + (pcase perc + ("To" "/\\") + ("Bo" "\\/") + ("Al" "[]") + (_ (let ((vec (vector "/|" "//" "||" "\\\\" "\\|" "\\|")) + (perc (string-to-number perc))) + (aref vec (floor (/ perc 17)))))))))) (defun +modeline-file-percentage-icon (&optional spacer) "Display the position in the current file as an icon." @@ -379,8 +380,8 @@ to a function in the current buffer, call that function instead." "Display the version control branch of the current buffer in the modeline." ;; from https://www.gonsie.com/blorg/modeline.html, from Doom (when-let ((backend (vc-backend buffer-file-name))) - (+modeline-spacer nil spacer - (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))))) + (+modeline-spacer nil spacer + (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))))) (defun +modeline-track (&optional spacer) "Display `tracking-mode' information." -- cgit 1.4.1-21-gabe81