summary refs log tree commit diff stats
path: root/lisp/+tab-bar.el
diff options
context:
space:
mode:
authorCase Duckworth2022-05-25 22:07:33 -0500
committerCase Duckworth2022-05-25 22:07:33 -0500
commit3da59fb2f6bcd1b5f19dc7f9a49e223dd2293e09 (patch)
treef7855986b30c5bc6e016fbfb67199d8abdd2cd0b /lisp/+tab-bar.el
parentmeh (diff)
downloademacs-3da59fb2f6bcd1b5f19dc7f9a49e223dd2293e09.tar.gz
emacs-3da59fb2f6bcd1b5f19dc7f9a49e223dd2293e09.zip
i'm doing a terrible job
Diffstat (limited to 'lisp/+tab-bar.el')
-rw-r--r--lisp/+tab-bar.el16
1 files changed, 13 insertions, 3 deletions
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 @@
17 17
18;; Common 18;; Common
19 19
20(defun +tab-bar-space (&optional n)
21 "Display a space N characters long, or 1."
22 `((space menu-item ,(+string-repeat (or n 1) " ") ignore)))
23
20(defun +tab-bar-misc-info () 24(defun +tab-bar-misc-info ()
21 "Display `mode-line-misc-info', formatted for the tab-bar." 25 "Display `mode-line-misc-info', formatted for the tab-bar."
22 `((misc-info menu-item ,(string-trim-right 26 `((misc-info menu-item ,(string-trim-right
@@ -66,7 +70,7 @@
66 "Display `display-time-string' in the tab-bar." 70 "Display `display-time-string' in the tab-bar."
67 (when display-time-mode 71 (when display-time-mode
68 `((date-time-string menu-item 72 `((date-time-string menu-item
69 ,(propertize (concat " " display-time-string)) 73 ,(substring-no-properties (concat " " (string-trim display-time-string)))
70 (lambda (ev) 74 (lambda (ev)
71 (interactive "e") 75 (interactive "e")
72 (popup-menu 76 (popup-menu
@@ -257,8 +261,14 @@ name to the left."
257 (require 'shr) ; `shr-string-pixel-width' 261 (require 'shr) ; `shr-string-pixel-width'
258 (let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format))) 262 (let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format)))
259 (rest (tab-bar-format-list rest)) 263 (rest (tab-bar-format-list rest))
260 (rest (mapconcat (lambda (item) (nth 2 item)) rest "")) 264 (rest (mapconcat (lambda (item) x(nth 2 item)) rest ""))
261 (hpos (shr-string-pixel-width rest)) 265 (hpos
266 ;; I have to rewrite `shr-string-pixel-width' to take the tab-bar face
267 ;; into account.
268 (let ((pt (point)))
269 (prog1 (with-temp-buffer (insert (propertize rest 'face 'tab-bar))
270 (shr-pixel-column))
271 (goto-char pt))))
262 (str (propertize " " 'display `(space :align-to (- right (,hpos)))))) 272 (str (propertize " " 'display `(space :align-to (- right (,hpos))))))
263 `((align-right menu-item ,str ignore)))) 273 `((align-right menu-item ,str ignore))))
264 274