From 3da59fb2f6bcd1b5f19dc7f9a49e223dd2293e09 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 25 May 2022 22:07:33 -0500 Subject: i'm doing a terrible job --- lisp/+avy.el | 2 +- lisp/+modeline.el | 12 ++++++++---- lisp/+tab-bar.el | 16 +++++++++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) (limited to 'lisp') diff --git a/lisp/+avy.el b/lisp/+avy.el index 0606405..8056f00 100644 --- a/lisp/+avy.el +++ b/lisp/+avy.el @@ -62,7 +62,7 @@ (setq buffer-face-mode-face +avy-buffer-face-mode-face) (buffer-face-mode +1))) -(define-minor-mode +avy-buffer-face-local-mode +(define-minor-mode +avy-buffer-face-mode "Turn off `buffer-face-mode' before doing Avy selections. Restore the mode after the selection." :lighter "" diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 2c9bbee..33d34c3 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el @@ -138,6 +138,9 @@ in the cdr will be applied to the major-mode in the mode line." :type '(alist :key-type function :value-type face)) +(defface +modeline-major-mode-face nil + "Face for modeline major-mode.") + (defun +modeline-major-mode (&optional spacer) "Display the current `major-mode'." (+modeline-spacer nil spacer @@ -149,10 +152,11 @@ in the cdr will be applied to the major-mode in the mode line." ;; 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))) + ;; (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] `(menu-item "Menu Bar" ignore diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 95f657d..e9daaf4 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el @@ -17,6 +17,10 @@ ;; Common +(defun +tab-bar-space (&optional n) + "Display a space N characters long, or 1." + `((space menu-item ,(+string-repeat (or n 1) " ") ignore))) + (defun +tab-bar-misc-info () "Display `mode-line-misc-info', formatted for the tab-bar." `((misc-info menu-item ,(string-trim-right @@ -66,7 +70,7 @@ "Display `display-time-string' in the tab-bar." (when display-time-mode `((date-time-string menu-item - ,(propertize (concat " " display-time-string)) + ,(substring-no-properties (concat " " (string-trim display-time-string))) (lambda (ev) (interactive "e") (popup-menu @@ -257,8 +261,14 @@ name to the left." (require 'shr) ; `shr-string-pixel-width' (let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format))) (rest (tab-bar-format-list rest)) - (rest (mapconcat (lambda (item) (nth 2 item)) rest "")) - (hpos (shr-string-pixel-width rest)) + (rest (mapconcat (lambda (item) x(nth 2 item)) rest "")) + (hpos + ;; I have to rewrite `shr-string-pixel-width' to take the tab-bar face + ;; into account. + (let ((pt (point))) + (prog1 (with-temp-buffer (insert (propertize rest 'face 'tab-bar)) + (shr-pixel-column)) + (goto-char pt)))) (str (propertize " " 'display `(space :align-to (- right (,hpos)))))) `((align-right menu-item ,str ignore)))) -- cgit 1.4.1-21-gabe81