diff options
author | Case Duckworth | 2022-08-19 13:39:13 -0500 |
---|---|---|
committer | Case Duckworth | 2022-08-19 13:39:13 -0500 |
commit | 7d0ff465220bec224c1f0c1163e6b4a88e1fb4c6 (patch) | |
tree | 6c36a8846bc74db584713948a6c382d66047e2ad /lisp/+tab-bar.el | |
parent | Add credit (diff) | |
download | emacs-7d0ff465220bec224c1f0c1163e6b4a88e1fb4c6.tar.gz emacs-7d0ff465220bec224c1f0c1163e6b4a88e1fb4c6.zip |
bleh
Diffstat (limited to 'lisp/+tab-bar.el')
-rw-r--r-- | lisp/+tab-bar.el | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 7ff991c..6c9debd 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el | |||
@@ -32,6 +32,19 @@ | |||
32 | "Hide the `tracking-mode' information when clocked in." | 32 | "Hide the `tracking-mode' information when clocked in." |
33 | :type 'boolean) | 33 | :type 'boolean) |
34 | 34 | ||
35 | (defun format-mode-line-unescaping (construct) | ||
36 | "Return a mode-line construct as a string, but unescape `%'s." | ||
37 | (format-mode-line | ||
38 | (cond ((listp construct) | ||
39 | (cl-loop for item in construct | ||
40 | collect (cond ((stringp item) | ||
41 | (string-replace "%" "%%" item)) | ||
42 | ((and (listp item) (eq :propertize (car item))) | ||
43 | (format-mode-line-unescaping item)) | ||
44 | (t item)))) | ||
45 | ((stringp construct) (string-replace "%" "%%" construct)) | ||
46 | (t construct)))) | ||
47 | |||
35 | (defun +tab-bar-tracking-mode () | 48 | (defun +tab-bar-tracking-mode () |
36 | "Display `tracking-mode-line-buffers' in the tab-bar." | 49 | "Display `tracking-mode-line-buffers' in the tab-bar." |
37 | ;; TODO: write something to convert a mode-line construct to a tab-bar | 50 | ;; TODO: write something to convert a mode-line construct to a tab-bar |
@@ -45,7 +58,7 @@ | |||
45 | as item = (nth i tracking-mode-line-buffers) | 58 | as item = (nth i tracking-mode-line-buffers) |
46 | collect (append (list (intern (format "tracking-mode-line-%s" i)) | 59 | collect (append (list (intern (format "tracking-mode-line-%s" i)) |
47 | 'menu-item | 60 | 'menu-item |
48 | (string-trim (format-mode-line item))) | 61 | (string-trim (format-mode-line-unescaping item))) |
49 | (if-let ((keymap (plist-get item 'keymap))) | 62 | (if-let ((keymap (plist-get item 'keymap))) |
50 | (list (alist-get 'down-mouse-1 (cdadr keymap))) | 63 | (list (alist-get 'down-mouse-1 (cdadr keymap))) |
51 | (list #'ignore)) | 64 | (list #'ignore)) |