From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bastian Beranek Newsgroups: gmane.emacs.bugs Subject: bug#46299: 28.0.50; Value of tab-bar-show not respected in new frames. Date: Tue, 16 Feb 2021 11:59:14 +0100 Message-ID: <87im6sffct.fsf@gmail.com> References: <871rdv4xog.fsf@gmail.com> <87v9b2ifrz.fsf@mail.linkov.net> <55ebad56-b440-198a-653e-1660040d5eae@gmx.at> <38b988fd-2ad6-a596-23a0-1d765249f718@gmx.at> <87tuqjydku.fsf@mail.linkov.net> <871rdlr4vc.fsf@mail.linkov.net> <87ft1zsu75.fsf@mail.linkov.net> <87im6ulbzz.fsf@mail.linkov.net> <87sg5xwskc.fsf@gmail.com> <87pn11z2n6.fsf@mail.linkov.net> <878s7pdlsi.fsf@gmail.com> 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="3884"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 46299@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 16 12:03:55 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 1lBy94-0000ul-4E for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Feb 2021 12:03:54 +0100 Original-Received: from localhost ([::1]:49744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lBy93-00071x-7J for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 Feb 2021 06:03:53 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBy5L-0003Qq-D5 for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2021 06:00:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56208) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lBy5K-0003GO-Pf for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2021 06:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lBy5K-00018K-Mu for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2021 06:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Bastian Beranek Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Feb 2021 11:00: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.16134731654284 (code B ref 46299); Tue, 16 Feb 2021 11:00:02 +0000 Original-Received: (at 46299) by debbugs.gnu.org; 16 Feb 2021 10:59:25 +0000 Original-Received: from localhost ([127.0.0.1]:39521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBy4i-000172-W4 for submit@debbugs.gnu.org; Tue, 16 Feb 2021 05:59:25 -0500 Original-Received: from mail-ed1-f54.google.com ([209.85.208.54]:44429) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBy4g-00016o-F3 for 46299@debbugs.gnu.org; Tue, 16 Feb 2021 05:59:24 -0500 Original-Received: by mail-ed1-f54.google.com with SMTP id g3so9059998edb.11 for <46299@debbugs.gnu.org>; Tue, 16 Feb 2021 02:59:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=xIB1kzeIv/6urXSLvtNziDtD+CM5pEVY4GhK70SxMsk=; b=WVUZj12eTDg/ReYN4Wna1RIBVXqC3TQd1T0YhAk/Rs2+fq4I9WfONreoPVzMbd0vTC blohYkfX9xuyHkcuXl69fMqq3F/HnrC+TP1g54Y9krbIZhsZ66im00lDgvEGsHlQRfRy kHlbk4D6iwJK9+hX8ATm+JkDtOfZKAFlmhIv0Vcrc9/OxMCPd9zQbmt8m2YUp+Vex7+u BxWJypYNonQYskZYMinRfsQZW3IVZV1iJ19YFT+7AavzzJ0FmrbykkaQxZ7bdQnbPkte 5eTS3M0y7Es8qWzLWCe2Lp1WRNOZpIrPfOgeToUYkmaa2iJ5tbWKcorQ8B0M+3kHoWOb bXZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=xIB1kzeIv/6urXSLvtNziDtD+CM5pEVY4GhK70SxMsk=; b=DWt2/jgS5gy685LHAH6IAURBCvEmh2RXxB1GBB6NVY3k/q5++Y2cOOOufpcA2ySEAH /so2uDiVMGfcxrN50oXOTkxBIQYq5/pk1U7rBveM4rEMhvRWmCgwzAiThY90gsg701dx 43WBfWn3q3XAB37+FA5pySxjF+Mxa07fWS5GNrl0kLdkrXsHJf96SBNC5XZyd08o4hiA bLWZZnyzUOccMoCgKrM7D1PYdYA4i1CFAtJkZSrDVoIL9gJtQyBesmRuO+BPfnozjzSn P0NW7NG3djRRy4Xo9Ye7Fau/+6F8cDbuMxtNaqejjOh+ofgS094asPmMlVo/LRu4Gi1y XqvQ== X-Gm-Message-State: AOAM532AArCiZE3oeaoSsEH038EttqrhNWvu0W6+hyMxhO1n3jDNfjRo 3D3lWi5uoxfWPMrh+uGoxANuExQocZTLyA== X-Google-Smtp-Source: ABdhPJwMFObtW6dpeNjVmIHqrWZ4Ath6hX44xmm6oaVDQdhBkRZ8Mlt3FQzkizaeY7arfgND0Ic3Bw== X-Received: by 2002:a05:6402:b2d:: with SMTP id bo13mr20029387edb.280.1613473156222; Tue, 16 Feb 2021 02:59:16 -0800 (PST) Original-Received: from bastian-desktop.gmail.com (b2b-130-180-23-226.unitymedia.biz. [130.180.23.226]) by smtp.gmail.com with ESMTPSA id y22sm4945197ejq.122.2021.02.16.02.59.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 02:59:15 -0800 (PST) In-Reply-To: <878s7pdlsi.fsf@gmail.com> (Bastian Beranek's message of "Mon, 15 Feb 2021 23:10:53 +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:200109 Archived-At: --=-=-= Content-Type: text/plain Bastian Beranek writes: > But how to go back? It seems that tab-bar-show should go back to "1" (in > order to make it a real toggle, i.e. it undoes itself). However, that > means that after the second toggle-frame-tab-bar the tab-bar will either > be shown or not, depending on the number of tabs opened at that specific > time. We have to consider that the user created or closed tabs in > between, so that means that there will be situations in which > toggle-frame-tab-bar does not really seem to do anything... For example: > > - 1 tab (tab bar hidden) > - create tab -> 2 tabs (tab bar shown) > - toggle-frame-tab-bar (tab bar hidden) > - close tab (tab bar hidden) > - toggle-frame-tab-bar (tab bar still hidden, because only 1 tab) I think what we could do is: a) always toggle the current visibility: That seems to be a must, it would be confusing otherwise. b) The first time toggle-frame-tab-bar is called, add a notice to the frame parameters that prevents tab-bar--update-tab-bar-lines from changing that frames tab-bar visibility. This means that after the toggle the tab-bar visibility keeps its state until toggle-frame-tab-bar is called again. c) When it is called a second time toggle-frame-tab-bar sets the new frame parameter to nil and flips the visibility again (see a). d) Then the tab-bar--update-tab-bar-lines logic will be active again, but only after a new tab is created or closed on that frame. This prevents the problem listed in my last mail, in the last step the tab-bar will be shown after toggling (although tab-bar-show is 1 and there is only one tab), but then once you create more tabs or close tabs it will revert to the usual behavior. Is this acceptable? Proposed patch is attached. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-behavior-of-toggle-frame-tab-bar-bug-46299.patch >From 5f158962c1bc63c10ebaa49357a16e45664d5579 Mon Sep 17 00:00:00 2001 From: Bastian Beranek Date: Tue, 16 Feb 2021 11:35:35 +0100 Subject: [PATCH] Fix behavior of toggle-frame-tab-bar (bug #46299) * lisp/tab-bar.el (toggle-frame-tab-bar): Add frame attribute to protect tab bar state from changing. (tab-bar--update-tab-bar-lines): Check for new attribute --- lisp/tab-bar.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 4e47ae2c10..2fa34385f1 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -161,7 +161,8 @@ tab-bar--update-tab-bar-lines (t frames)))) ;; Loop over all frames and update default-frame-alist (dolist (frame frame-lst) - (set-frame-parameter frame 'tab-bar-lines (tab-bar--tab-bar-lines-for-frame frame)))) + (unless (frame-parameter frame 'tab-bar-lines-keep-state) + (set-frame-parameter frame 'tab-bar-lines (tab-bar--tab-bar-lines-for-frame frame))))) (when (eq frames t) (setq default-frame-alist (cons (cons 'tab-bar-lines (if (and tab-bar-mode (eq tab-bar-show t)) 1 0)) @@ -233,7 +234,9 @@ toggle-frame-tab-bar (add-hook 'after-make-frame-functions 'toggle-frame-tab-bar)" (interactive) (set-frame-parameter frame 'tab-bar-lines - (if (> (frame-parameter frame 'tab-bar-lines) 0) 0 1))) + (if (> (frame-parameter frame 'tab-bar-lines) 0) 0 1)) + (set-frame-parameter frame 'tab-bar-lines-keep-state + (not (frame-parameter nil 'tab-bar-lines-keep-state)))) (defvar tab-bar-map (make-sparse-keymap) "Keymap for the tab bar. -- 2.30.1 --=-=-=--