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#46299: 28.0.50; Value of tab-bar-show not respected in new frames. Date: Wed, 10 Feb 2021 20:24:49 +0200 Organization: LINKOV.NET Message-ID: <87tuqjydku.fsf@mail.linkov.net> References: <871rdv4xog.fsf@gmail.com> <87k0rmnbqs.fsf@mail.linkov.net> <87a6sfu0fi.fsf@mail.linkov.net> <87v9b2ifrz.fsf@mail.linkov.net> <55ebad56-b440-198a-653e-1660040d5eae@gmx.at> <38b988fd-2ad6-a596-23a0-1d765249f718@gmx.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28394"; 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: 46299@debbugs.gnu.org To: Bastian Beranek Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 10 19:44:25 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 1l9uTN-0007Cu-Hl for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Feb 2021 19:44:21 +0100 Original-Received: from localhost ([::1]:33614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9uTM-0006Ib-JW for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Feb 2021 13:44:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9uR8-0005BU-Qe for bug-gnu-emacs@gnu.org; Wed, 10 Feb 2021 13:42:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9uR8-0003pe-Jl for bug-gnu-emacs@gnu.org; Wed, 10 Feb 2021 13:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l9uR8-0003gh-GS for bug-gnu-emacs@gnu.org; Wed, 10 Feb 2021 13:42:02 -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, 10 Feb 2021 18:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46299 X-GNU-PR-Package: emacs Original-Received: via spool by 46299-submit@debbugs.gnu.org id=B46299.161298251514155 (code B ref 46299); Wed, 10 Feb 2021 18:42:02 +0000 Original-Received: (at 46299) by debbugs.gnu.org; 10 Feb 2021 18:41:55 +0000 Original-Received: from localhost ([127.0.0.1]:57223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9uR0-0003gE-UQ for submit@debbugs.gnu.org; Wed, 10 Feb 2021 13:41:55 -0500 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:55693) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9uQy-0003fn-30 for 46299@debbugs.gnu.org; Wed, 10 Feb 2021 13:41:53 -0500 X-Originating-IP: 91.129.108.204 Original-Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 874221BF203; Wed, 10 Feb 2021 18:41:43 +0000 (UTC) In-Reply-To: (Bastian Beranek's message of "Tue, 9 Feb 2021 12:44:47 +0100") 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:199793 Archived-At: > Hope this is satisfactory, if not please feel free to adjust as you wish. Thanks, please see more comments: > +(defun tab-bar--tab-bar-lines-for-frame (frame) > + (if (not tab-bar-mode) > + 0 > + (cond > + ((eq tab-bar-show t) 1) > + ((natnump tab-bar-show) > + (if (> (length (funcall tab-bar-tabs-function frame)) tab-bar-show) 1 0)) > + (t 0)))) A small optimization: ((not tab-bar-mode) 0) could be added as the first condition of the same 'cond'. > :set (lambda (sym val) > (set-default sym val) > ;; Preload button images > + ;; Note: tab-bar-mode updates tab-bar-lines as well. > + (tab-bar-mode 1)) Not sure whether the users would want to enable tab-bar-mode unconditionally after customizing tab-bar-show. Maybe when customized tab-bar-show to nil, only call tab-bar--update-tab-bar-lines in all frames? Or maybe simply to disable the tab bar with (tab-bar-mode 0) when customized to nil? > @@ -852,16 +867,15 @@ After the tab is created, the hooks in > + ;; Switch on tab-bar-mode, since a tab was created > + (when tab-bar-show > (tab-bar-mode 1)) > + > + ;; Recalculate tab-bar-lines and update frames > + (tab-bar--update-tab-bar-lines (selected-frame)) > + (when tab-bar-mode > + (tab-bar--load-buttons) > + (tab-bar--define-keys)) Would you agree that here in tab-bar-new-tab-to, the first call of tab-bar-mode should already do all these calls: tab-bar--update-tab-bar-lines, tab-bar--load-buttons, tab-bar--define-keys? So maybe it should be sufficient just to leave these 2 lines here: (when tab-bar-show (tab-bar-mode 1))