summaryrefslogtreecommitdiff
path: root/lisp/tab-bar.el
diff options
context:
space:
mode:
authorGabriel do Nascimento Ribeiro <gabriel376@hotmail.com>2022-12-15 11:58:30 -0300
committerJuri Linkov <juri@linkov.net>2022-12-15 20:00:21 +0200
commitb211a63455cad72f4883ef1494502633f8ac19be (patch)
treef94d0fbeb0c9eb08554265717f0cdec0cc24f977 /lisp/tab-bar.el
parent367022f316e22619dd223a4a0fcd523397ffc84e (diff)
downloademacs-b211a63455cad72f4883ef1494502633f8ac19be.tar.gz
emacs-b211a63455cad72f4883ef1494502633f8ac19be.tar.bz2
emacs-b211a63455cad72f4883ef1494502633f8ac19be.zip
Make tab-bar-tab-group-format-function also handle current group
* lisp/tab-bar.el (tab-bar--format-tab-group): Call 'tab-bar-tab-group-format-default' to format current group tab. (tab-bar-tab-group-format-default): Update function to also handle current group tab (bug#60073).
Diffstat (limited to 'lisp/tab-bar.el')
-rw-r--r--lisp/tab-bar.el22
1 files changed, 11 insertions, 11 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 162e63fe230..1f25ee6d7e4 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -844,8 +844,9 @@ Function gets one argument: a tab."
(defcustom tab-bar-tab-group-format-function #'tab-bar-tab-group-format-default
"Function to format a tab group name.
-Function gets two arguments, a tab with a group name and its number,
-and should return the formatted tab group name to display in the tab bar."
+Function gets three arguments, a tab with a group name, its
+number and an optional t when the tab is current, and should
+return the formatted tab group name to display in the tab bar."
:type 'function
:initialize 'custom-initialize-default
:set (lambda (sym val)
@@ -854,11 +855,13 @@ and should return the formatted tab group name to display in the tab bar."
:group 'tab-bar
:version "28.1")
-(defun tab-bar-tab-group-format-default (tab i)
- (propertize
- (concat (if tab-bar-tab-hints (format "%d " i) "")
- (funcall tab-bar-tab-group-function tab))
- 'face 'tab-bar-tab-group-inactive))
+(defun tab-bar-tab-group-format-default (tab i &optional current-p)
+ (let ((name (concat (if tab-bar-tab-hints (format "%d " i) "")
+ (funcall tab-bar-tab-group-function tab)))
+ (face (if current-p
+ 'tab-bar-tab-group-current
+ 'tab-bar-tab-group-inactive)))
+ (propertize name 'face face)))
(defcustom tab-bar-tab-group-face-function #'tab-bar-tab-group-face-default
"Function to define a tab group face.
@@ -881,10 +884,7 @@ when the tab is current. Return the result as a keymap."
`((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore))
`((,(intern (format "group-%i" i))
menu-item
- ,(if current-p
- (propertize (funcall tab-bar-tab-group-function tab)
- 'face 'tab-bar-tab-group-current)
- (funcall tab-bar-tab-group-format-function tab i))
+ ,(funcall tab-bar-tab-group-format-function tab i current-p)
,(if current-p 'ignore
(or
(alist-get 'binding tab)