From 44d74b2bc9616bd6061b27667b8701c955b7b33f Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 29 Jul 2024 21:27:30 +0300 Subject: [PATCH] * lisp/tab-bar.el (tab-bar-show-inactive-group-tabs): New defcustom. (tab-bar-format-tabs-groups): Use it (bug#71939). Suggested by Ship Mints . (cherry picked from commit 63e609f6aa1e058c709b84cf132fab7ce7ecb5ee) --- lisp/tab-bar.el | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 4edcb27fb04..a4d40c5de7f 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1064,6 +1064,16 @@ when the tab is current. Return the result as a keymap." (tab-bar-select-tab ,i)))) :help "Click to visit group")))) +(defcustom tab-bar-show-inactive-group-tabs nil + "Show tabs even if they are in inactive groups." + :type 'boolean + :initialize #'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (force-mode-line-update)) + :group 'tab-bar + :version "31.1") + (defun tab-bar-format-tabs-groups () "Produce tabs for the tab bar grouped according to their groups." (let* ((tabs (funcall tab-bar-tabs-function)) @@ -1080,7 +1090,8 @@ when the tab is current. Return the result as a keymap." ((or (equal tab-group current-group) (not tab-group)) (append ;; Prepend current group name before first tab - (when (and (not (equal previous-group tab-group)) tab-group) + (when (and (not (equal previous-group tab-group)) + tab-group) (tab-bar--format-tab-group tab i t)) ;; Override default tab faces to use group faces (let ((tab-bar-tab-face-function @@ -1088,9 +1099,17 @@ when the tab is current. Return the result as a keymap." (tab-bar--format-tab tab i)))) ;; Show first tab of other groups with a group name ((not (equal previous-group tab-group)) - (tab-bar--format-tab-group tab i)) + (append + (tab-bar--format-tab-group tab i) + (when tab-bar-show-inactive-group-tabs + (let ((tab-bar-tab-face-function + tab-bar-tab-group-face-function)) + (tab-bar--format-tab tab i))))) ;; Hide other group tabs - (t nil)) + (t (when tab-bar-show-inactive-group-tabs + (let ((tab-bar-tab-face-function + tab-bar-tab-group-face-function)) + (tab-bar--format-tab tab i))))) (setq previous-group tab-group)))) tabs))) -- 2.39.5