Subject: bug#79159: [PATCH] Do not display in the tab line tabs that are excluded.

From: Juri Linkov <[email-masked]>
Date: Tue, 05 Aug 2025 09:31:34 +0300

> +         (or (with-current-buffer b
> +               (memq major-mode tab-line-exclude-modes))

Optimization without using 'with-current-buffer':

  (buffer-local-value 'major-mode b)

> @@ -598,7 +626,9 @@ tab-line-tabs-fixed-window-buffers
>                                (lambda (buf idx) (puthash buf idx index-table))
>                                old-buffers)
>                               index-table))
> -         (new-buffers (sort (tab-line-tabs-window-buffers)
> +         (buffer-list (tab-line-displayable-tab-list
> +                       (funcall tab-line-tabs-fixed-buffer-list-function)))

Please don't hardcode 'tab-line-displayable-tab-list'.

The proper way is to have a predicate user option with two const values:
one is a function that returns all buffers, another that omits excluded
buffers, and a slot for a user-defined custom function.

Maybe the existing 'tab-line-tabs-buffer-list-function'
should be promoted to the user option.