]> git.eshelyaron.com Git - emacs.git/commitdiff
Add more ways to exclude buffers in tab-line-mode. (Bug#78988)
authorElías Gabriel Pérez <eg642616@gmail.com>
Thu, 10 Jul 2025 22:40:34 +0000 (16:40 -0600)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 11:53:44 +0000 (13:53 +0200)
* 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

index 0b8f5919e3576ad632f98ef763a9c2b2d81c651f..636b217ada854a4098edd0eb32f10c7e94d54ef3 100644 (file)
@@ -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)))