Subject: bug#46299: 28.0.50; Value of tab-bar-show not respected in new frames.

From: Bastian Beranek <[email-masked]>
Date: Fri, 5 Feb 2021 11:10:01 +0100

Hey Juri,

On Fri, Feb 5, 2021 at 10:22 AM Juri Linkov <[email-masked]> wrote:
>
> > I noticed that with the latest master branch setting tab-bar-show
> > to "1" does not work work for new frames. On those the tabs are shown
> > even if tab-bar-show is set to 1.
>
> Thanks for finding a case that is still unhandled.
>
> > I suppose a hook is needed which applies the correct setting
> > to the new frame?
>
> Generally, Emacs core packages should avoid adding own code
> to hooks, because hooks are intended mostly for users, such as
> for example, configuring to enable tab-bar selectively:
>
>   (add-hook 'after-make-frame-functions 'toggle-frame-tab-bar)
>
> Fortunately, frames provide a better way to set their default values
> with default-frame-alist, that tab-bar-mode already modifies.

Oh I see. Yes that would also work. Although I would say that in
general it should be more robust to have a dynamic function which
counts the numbers of tabs and adapts the number of tab-bar-lines
according to the value of tab-bar show. Is it guaranteed that new
frames only have one tab?

> So doing something similar fixes the problem:

That patch looks fine, except that my bug report translates equally to
the case when tab-bar-show is nil, so (eq val 1) should be adapted to
catch both "1" and "nil".

Thanks for your help!
Bastian