about summary refs log tree commit diff stats
path: root/lisp/+tab-bar.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/+tab-bar.el')
-rw-r--r--lisp/+tab-bar.el55
1 files changed, 25 insertions, 30 deletions
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 2e9198c..b11be2c 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el
@@ -22,7 +22,7 @@
22 `((global menu-item ,(string-trim-right 22 `((global menu-item ,(string-trim-right
23 (format-mode-line mode-line-misc-info)) 23 (format-mode-line mode-line-misc-info))
24 24
25 ignore))) 25 ignore :help (discord-date-string))))
26 26
27(defvar +tab-bar-show-original nil 27(defvar +tab-bar-show-original nil
28 "Original value of `tab-bar-show'.") 28 "Original value of `tab-bar-show'.")
@@ -129,35 +129,30 @@ Used by `tab-bar-format-menu-bar'."
129;;; Tab bar format tabs 129;;; Tab bar format tabs
130 130
131(require 'el-patch) 131(require 'el-patch)
132 132(el-patch-feature tab-bar)
133(el-patch-defun tab-bar--format-tab (tab i) 133(with-eval-after-load 'tab-bar
134 (append 134 (el-patch-defun tab-bar--format-tab (tab i)
135 (el-patch-remove 135 "Format TAB using its index I and return the result as a keymap."
136 `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore))) 136 (append
137 (cond 137 (el-patch-remove
138 ((eq (car tab) 'current-tab) 138 `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore)))
139 `((current-tab 139 (cond
140 menu-item 140 ((eq (car tab) 'current-tab)
141 ,(funcall tab-bar-tab-name-format-function tab i) 141 `((current-tab
142 ignore 142 menu-item
143 :help "Current tab"))) 143 ,(funcall tab-bar-tab-name-format-function tab i)
144 (t 144 ignore
145 `((,(intern (format "tab-%i" i)) 145 :help "Current tab")))
146 menu-item 146 (t
147 ,(funcall tab-bar-tab-name-format-function tab i) 147 `((,(intern (format "tab-%i" i))
148 ,(or 148 menu-item
149 (alist-get 'binding tab) 149 ,(funcall tab-bar-tab-name-format-function tab i)
150 `(lambda () 150 ,(alist-get 'binding tab)
151 (interactive) 151 :help "Click to visit tab"))))
152 (tab-bar-select-tab ,i))) 152 (when (alist-get 'close-binding tab)
153 :help "Click to visit tab")))) 153 `((,(if (eq (car tab) 'current-tab) 'C-current-tab (intern (format "C-tab-%i" i)))
154 `((,(if (eq (car tab) 'current-tab) 'C-current-tab (intern (format "C-tab-%i" i))) 154 menu-item ""
155 menu-item "" 155 ,(alist-get 'close-binding tab)))))))
156 ,(or
157 (alist-get 'close-binding tab)
158 `(lambda ()
159 (interactive)
160 (tab-bar-close-tab ,i)))))))
161 156
162 157
163;; Emacs 27 158;; Emacs 27