From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#45556: 27.1; Unexpected behavior of `tab-bar-show' variable Date: Wed, 06 Jan 2021 20:04:25 +0200 Organization: LINKOV.NET Message-ID: <87im8a54d2.fsf@mail.linkov.net> References: <20201230214419.1eca9494@argon> <87zh1njkbf.fsf@mail.linkov.net> <20210106110429.066f2715@argon> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22696"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 45556@debbugs.gnu.org To: Marcel Ventosa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 06 19:12:16 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kxDI6-0005lP-AO for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Jan 2021 19:12:14 +0100 Original-Received: from localhost ([::1]:37810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxDI5-0005qW-8O for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Jan 2021 13:12:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxDHu-0005qN-0x for bug-gnu-emacs@gnu.org; Wed, 06 Jan 2021 13:12:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kxDHt-00085c-QA for bug-gnu-emacs@gnu.org; Wed, 06 Jan 2021 13:12:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kxDHt-0005Rw-Lq for bug-gnu-emacs@gnu.org; Wed, 06 Jan 2021 13:12:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Jan 2021 18:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45556 X-GNU-PR-Package: emacs Original-Received: via spool by 45556-submit@debbugs.gnu.org id=B45556.160995666620886 (code B ref 45556); Wed, 06 Jan 2021 18:12:01 +0000 Original-Received: (at 45556) by debbugs.gnu.org; 6 Jan 2021 18:11:06 +0000 Original-Received: from localhost ([127.0.0.1]:45490 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kxDGz-0005Qe-L7 for submit@debbugs.gnu.org; Wed, 06 Jan 2021 13:11:05 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:65531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kxDGv-0005Oj-U0 for 45556@debbugs.gnu.org; Wed, 06 Jan 2021 13:11:02 -0500 X-Originating-IP: 91.129.98.64 Original-Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64]) (Authenticated sender: juri@linkov.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 9A92440006; Wed, 6 Jan 2021 18:10:55 +0000 (UTC) In-Reply-To: <20210106110429.066f2715@argon> (Marcel Ventosa's message of "Wed, 6 Jan 2021 11:04:29 +0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:197440 Archived-At: --=-=-= Content-Type: text/plain > This was not a bug after all. But would it be useful to mention in the > doc string that the variable's behavior will be different if modified > by setq? Or is this already common knowledge? Thank you for the suggestion to mention this in the doc string. While updating the doc string, I noticed the problem that currently it doesn't update each frame individually according to the new customized value, so this problem will be fixed with this patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=tab-bar-show.patch diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 5a95e5975d..69746d5f84 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -236,18 +236,27 @@ tab-bar-show and show it again once more tabs are created. If nil, always keep the tab bar hidden. In this case it's still possible to use persistent named window configurations by relying on -keyboard commands `tab-new', `tab-close', `tab-next', `tab-switcher', etc." +keyboard commands `tab-new', `tab-close', `tab-next', `tab-switcher', etc. + +Please customize this variable using the Customization UI, then +it will automatically update the existing tab bars on each frame." :type '(choice (const :tag "Always" t) (const :tag "When more than one tab" 1) (const :tag "Never" nil)) :initialize 'custom-initialize-default :set (lambda (sym val) (set-default sym val) - (tab-bar-mode - (if (or (eq val t) - (and (natnump val) - (> (length (funcall tab-bar-tabs-function)) val))) - 1 -1))) + ;; Preload button images + (tab-bar-mode 1) + ;; Then handle each frame individually + (dolist (frame (frame-list)) + (set-frame-parameter + frame 'tab-bar-lines + (if (or (eq val t) + (and (natnump val) + (> (length (funcall tab-bar-tabs-function frame)) + val))) + 1 0)))) :group 'tab-bar :version "27.1") --=-=-= Content-Type: text/plain > Somehow reading a function name "toggle-tab-bar-mode..." my > understanding is that such a function would enable and disable tab-bar > functionality itself, rather than only show and hide the bar. I see > now that toggling the 'tab-bar-mode' minor mode also does not > enable/disable the tab-bar functionality, but rather seems to just > toggle the actual bar. Is this correct? This is almost correct. Additionally, 'tab-bar-mode' also loads button images and assigns C-TAB keys. > If so, what is the difference between 'toggle-tab-bar-mode-from-frame' > and 'tab-bar-mode'. Both of them seem to toggle the tab bar in > _all_ frames. Indeed, 'tab-bar-mode' toggles the tab bar in all frames, but 'toggle-tab-bar-mode-from-frame' is a very specialized command. It's used only in the Show/Hide menu, to have the toggle reflect the current frame, as the comment before its definition says. Maybe this comment should be moved to its doc string like this: diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 5a95e5975d..e239a02a64 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -187,9 +187,9 @@ tab-bar-handle-mouse ;; Clicking anywhere outside existing tabs will add a new tab (tab-bar-new-tab))))) -;; Used in the Show/Hide menu, to have the toggle reflect the current frame. (defun toggle-tab-bar-mode-from-frame (&optional arg) "Toggle tab bar on or off, based on the status of the current frame. +Used in the Show/Hide menu, to have the toggle reflect the current frame. See `tab-bar-mode' for more information." (interactive (list (or current-prefix-arg 'toggle))) (if (eq arg 'toggle) --=-=-=--