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/+tab-bar.el | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'lisp/+tab-bar.el') 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