bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45556: 27.1; Unexpected behavior of `tab-bar-show' variable


From: Juri Linkov
Subject: bug#45556: 27.1; Unexpected behavior of `tab-bar-show' variable
Date: Tue, 05 Jan 2021 20:43:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> (tab-bar-mode)
> ;; tab bar is shown on top of buffer
> (setq tab-bar-show 1)
> ;; no change. Maybe we need to toggle the mode to effect changes?

This is expected behavior because tab-bar-show is designed
to be customized using

  (customize-set-variable 'tab-bar-show 1)

> (tab-bar-mode 0)
> ;; bar disappears
> (tab-bar-mode)
> ;; bar still reappears with only one tab
> ;; expected behavior: tab bar remains hidden because only one tab exists

Actually the low-level function 'tab-bar-mode' was designed
to give more freedom to override the value of 'tab-bar-show'.
So you don't need to use 'tab-bar-mode' because
after customizing 'tab-bar-show', the commands
'tab-bar-new-tab' and 'tab-bar-close-tab' will do the right thing
as your next examples demonstrate:

> (tab-bar-new-tab)
> ;; two tabs exist and are visible
> (tab-bar-close-tab)
> ;; only one tab is left, tab bar is hidden

But below again, no need to use low-level tab-bar-mode,
and tab-bar-show should be changed with customize.

> (tab-bar-mode)
> ;; turn mode off again
> (setq tab-bar-show nil)
> ;; no bar should be visible if I turn tab-bar-mode on again
> (tab-bar-mode)
> ;; tab bar is still visible even with the variable set to nil

So there are two levels: at high level you can customize 'tab-bar-show',
and tab commands do the right thing.

If you want more control, then you can use 'tab-bar-mode'.
Or if you want to enable/disable the tab bar individually
on each new frame, then you can use such configuration:

  (add-hook 'after-make-frame-functions 'toggle-frame-tab-bar)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]