unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Marcel Ventosa <mve1@runbox.com>
Cc: 45556@debbugs.gnu.org
Subject: bug#45556: 27.1; Unexpected behavior of `tab-bar-show' variable
Date: Tue, 05 Jan 2021 20:43:48 +0200	[thread overview]
Message-ID: <87zh1njkbf.fsf@mail.linkov.net> (raw)
In-Reply-To: <20201230214419.1eca9494@argon> (Marcel Ventosa's message of "Wed, 30 Dec 2020 21:44:19 +0700")

> (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	other threads:[~2021-01-05 18:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-30 14:44 bug#45556: 27.1; Unexpected behavior of `tab-bar-show' variable Marcel Ventosa
2021-01-05 18:43 ` Juri Linkov [this message]
2021-01-06  4:04   ` Marcel Ventosa
2021-01-06 18:04     ` Juri Linkov
2021-01-07 18:09       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zh1njkbf.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=45556@debbugs.gnu.org \
    --cc=mve1@runbox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).