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

From: "Elijah G." <[email-masked]>
Date: Wed, 06 Aug 2025 22:19:57 -0600

Juri Linkov <[email-masked]> writes:

[...]

>> No, it will just sweep the problem under the carpet.  Since when are
>> we handling bugs in this manner?  If a feature needs work to be
>> finished, let's please invest the effort to do that work.  Let's
>> please not have semi-broken features.
>
> Currently there is a bug in tab-line.el, and the proposed patch fixes
> it.
>
> Without activating global-tab-line-mode try the following:
>
> 0. emacs -Q
> 1. C-x b SPC *bar* RET
> 2. C-x b foo RET
> 3. C-x <left>
>
> It switches to the initial buffer *scratch*,
> skipping the excluded buffer " *bar*".
>
> Without the proposed patch the tab-line is broken,
> because it displays the excluded buffer,
> but 'C-x <left>' can't switch to it.
>
> So tab-line.el should follow the logic of window.el
> and omit excluded buffers as well.

Yes, I've noticed this "bug", i have many buffers excluded, and when (for
some reason) they appear in my tab line (or I accidentally switch to
them), they are going to end up flooding my tab line, and it will be
hard to switch buffers via "C-x <left>|<right>".

But i agree this should be an option, maybe disabled by default, since
it seems that no one had reported this as a bug before.

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

> Optimization without using 'with-current-buffer':

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

Thanks, i forgot this exists.

> > @@ -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.

I like the idea, but the problem is that
`tab-line-tabs-buffer-list-function' is used only for
`tab-line-tabs-mode-buffers' and `tab-line-tabs-buffer-groups'.

Maybe the function should take an optional argument if it should list
only window buffers, so it can be used in
'tab-line-tabs-fixed-window-buffers' and others.

-- 
- E.G via GNU Emacs Android port.