(defcustom tab-bar-tab-group-format-function #'tab-bar-tab-group-format-default
"Function to format a tab group name.
-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."
+Function gets three arguments, a tab with a group name, its number, and
+an optional value that is non-nil when the tab is from the current group.
+It should return the formatted tab group name to display in the tab bar."
:type 'function
:initialize 'custom-initialize-default
:set (lambda (sym val)
:version "28.1")
(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)))
+ (propertize
+ (concat (if (and tab-bar-tab-hints (not current-p)) (format "%d " i) "")
+ (funcall tab-bar-tab-group-function tab))
+ 'face (if current-p 'tab-bar-tab-group-current 'tab-bar-tab-group-inactive)))
(defcustom tab-bar-tab-group-face-function #'tab-bar-tab-group-face-default
"Function to define a tab group face.
`((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore))
`((,(intern (format "group-%i" i))
menu-item
- ,(funcall tab-bar-tab-group-format-function tab i current-p)
+ ,(if current-p
+ (condition-case nil
+ (funcall tab-bar-tab-group-format-function tab i current-p)
+ ;; We used to define tab-bar-tab-group-format-function as
+ ;; taking two arguments but after adding the third argument
+ ;; we need to provide backwards-compatibility.
+ (wrong-number-of-arguments
+ (propertize (funcall tab-bar-tab-group-function tab)
+ 'face 'tab-bar-tab-group-current)))
+ (funcall tab-bar-tab-group-format-function tab i))
,(if current-p 'ignore
(or
(alist-get 'binding tab)