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

From: Juri Linkov <[email-masked]>
Date: Mon, 11 Aug 2025 09:08:00 +0300

>> > +(defvar tab-line-tabs-window-buffers-filter-function
>> > +  #'tab-line-tabs-window-buffers-filter-default
>> > +  "Filter which buffers should be displayed in the tab line.")
>> 
>> Shouldn't this be defcustom?  Then you can add a const 'identity'
>> to allow keeping excluded buffers.
>
> Didn't you say that keeping them produces buggy behavior?  If so, why
> would we tempt users to produce bugs?

It's not so simple.  Currently tab-line is disabled on these conditions:

              (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)))

Buggy behavior is produced only on the first condition:
when the buffer name begins with a space.

So the default predicate should use exactly the same conditions
in the filter to hide buffers on the tab-line.

And also defcustom should provide another value to get back
almost the same behavior as current, with one exception that
buffers with names that begin with a space should be hidden too,
i.e. the second value should match only one condition:

              (string-match-p "\\` " (buffer-name))