From 80da6611588c65d3cbcdbef51c11d51e808950e8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= Date: Thu, 10 Jul 2025 16:40:34 -0600 Subject: [PATCH] Add more ways to exclude buffers in tab-line-mode. (Bug#78988) * etc/NEWS: Announce changes. * lisp/tab-line.el (tab-line-exclude-buffer): New user option. (tab-line-mode--turn-on): Update conditions. (cherry picked from commit 6053a7f1a4a862bee6a83ab5d69531672c7f9652) --- lisp/tab-line.el | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 0b8f5919e35..636b217ada8 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -1244,11 +1244,38 @@ button, so you could have one more buffer shown on the tab line." '(completion-list-mode) "List of major modes for which the tab-line display is not enabled. Buffers under any of these major modes will not show the tab line in -their windows, even if `global-tab-line-mode' is enabled." +their windows, even if `global-tab-line-mode' is enabled. + +See also `tab-line-exclude-buffers', for exclude buffers." :type '(repeat symbol) :group 'tab-line :version "27.1") +(defcustom tab-line-exclude-buffers nil + "Whether tab-line should not be enabled in a buffer. + +The value must be a condition which is passed to `buffer-match-p' (which +see). + +You can include multiple conditions, for example: + + To exclude multiple modes and buffer names: + \='(or \"\\*eshell\\*\" + (derived-mode completion-list-mode + eshell-mode + term-mode + ...) + ...) + +If the condition yields a non-nil value, tab line will not be enabled in +those buffers. + +See also `tab-line-exclude-modes', for only exclude major modes." + :type '(buffer-predicate :tag "Predicate for `buffer-match-p'") + :safe #'booleanp + :group 'tab-line + :version "31.1") + ;;;###autoload (defvar-local tab-line-exclude nil) @@ -1262,6 +1289,7 @@ of `tab-line-exclude', are exempt from `tab-line-mode'." (unless (or (minibufferp) (string-match-p "\\` " (buffer-name)) (memq major-mode tab-line-exclude-modes) + (buffer-match-p tab-line-exclude-buffers (buffer-name)) (get major-mode 'tab-line-exclude) (buffer-local-value 'tab-line-exclude (current-buffer))) (tab-line-mode 1))) -- 2.39.5