From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: James N. V. Cash Newsgroups: gmane.emacs.bugs Subject: bug#42052: 28.0.50; tab-bar-mode should be frame-local Date: Sun, 28 Jun 2020 20:26:29 -0400 Message-ID: <87pn9ivhsa.fsf@gmail.com> References: <87zh8qq57v.fsf@gmail.com> <87sgegdqmt.fsf@mail.linkov.net> <871rlzwfm2.fsf@gmail.com> <87wo3rug82.fsf@gmail.com> <87pn9idbj2.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="32169"; mail-complaints-to="usenet@ciao.gmane.io" To: 42052@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 29 02:27:09 2020 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 1jphdd-0008Hv-Gx for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Jun 2020 02:27:09 +0200 Original-Received: from localhost ([::1]:57364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jphdc-0000Tg-1T for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Jun 2020 20:27:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jphdW-0000TO-7S for bug-gnu-emacs@gnu.org; Sun, 28 Jun 2020 20:27:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35694) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jphdV-00048I-Sz for bug-gnu-emacs@gnu.org; Sun, 28 Jun 2020 20:27:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jphdV-0007ag-Nt for bug-gnu-emacs@gnu.org; Sun, 28 Jun 2020 20:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: James N. V. Cash Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Jun 2020 00:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42052 X-GNU-PR-Package: emacs Original-Received: via spool by 42052-submit@debbugs.gnu.org id=B42052.159339039929143 (code B ref 42052); Mon, 29 Jun 2020 00:27:01 +0000 Original-Received: (at 42052) by debbugs.gnu.org; 29 Jun 2020 00:26:39 +0000 Original-Received: from localhost ([127.0.0.1]:47240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jphd9-0007Zz-Fe for submit@debbugs.gnu.org; Sun, 28 Jun 2020 20:26:39 -0400 Original-Received: from mail-qk1-f172.google.com ([209.85.222.172]:44018) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jphd6-0007Zk-Ms for 42052@debbugs.gnu.org; Sun, 28 Jun 2020 20:26:39 -0400 Original-Received: by mail-qk1-f172.google.com with SMTP id c30so9993790qka.10 for <42052@debbugs.gnu.org>; Sun, 28 Jun 2020 17:26:36 -0700 (PDT) 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:cc:subject:in-reply-to:references :date:message-id:mime-version; bh=EV5IH6ynzd4cfwT3arethQFTv+semTA+WndNu4DWQg0=; b=nXrpQEqIZrx7I1OoNDTfaVLhOyPw180pE/cAyvPsza6Ay1yD7SCQ4ebq9h/XSLYF7W sRrNrZFD4bvJY/zKom87UbXfNKMruRUursfbGEn9EwXO2tnJyDPFGGKf+hfhe+mzCkpc jfJ5Ew1vrlGYCbw5bUaEeTEo+qOI5zHpG3vyhMGuGqGTIfSjrW8KYUpaw/vY+VChAxqK wq6urTS+eD1mudUob3cXBmZ1Y18vLmTZjT07lRvfY1JrDXxqJpFmMRvU8DpeB11MniNR LQA1E65KnRxFBqLVl1ZMdTMwNTlp2kZKxPlgon4CmbXH9hyQkvrkC1bCvretyAZKNwWw FV6w== X-Gm-Message-State: AOAM531W6tO9fZvhAA38IfpLRo0hpBkrqvX36zNo15AWOodAofL7E4MI gUJH66QrR5bzgUJXLMi+bLJ1F9TJaLE= X-Google-Smtp-Source: ABdhPJxhcftc07EmZ5AiVcjmN68Bw2T0uU9/srYB6+YCZmBhJ+GvtrFk2IWVNwyGg7Qwqmd3RKoYpg== X-Received: by 2002:ae9:ea13:: with SMTP id f19mr7115201qkg.331.1593390390953; Sun, 28 Jun 2020 17:26:30 -0700 (PDT) Original-Received: from gonk ([2607:f2c0:e360:1126:b892:e1bb:7c65:665b]) by smtp.gmail.com with ESMTPSA id w28sm12109912qkw.92.2020.06.28.17.26.30 for <42052@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Jun 2020 17:26:30 -0700 (PDT) In-Reply-To: <87pn9idbj2.fsf@mail.linkov.net> 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:182507 Archived-At: Juri Linkov writes: > Please don't forget to remove this debugging message in the final patch. Oh oops, sorry about that. > Unlike other places that simply use (set-frame-parameter nil 'tab-bar-lines 0) > this code is more complex. But it seems it should work with just > (set-frame-parameter nil 'tab-bar-lines 0) as well. Ah, right. I was thinking that > BTW, I see a problem in the old code: the variable 'tabs' is not always updated > and sometimes contains obsolete data. It should help to replace > > (<= (length tabs) tab-bar-show) > > with > > (<= (length (funcall tab-bar-tabs-function)) tab-bar-show) > > that gets fresh data. That makes sense. Here's another patch that addresses this issues, although as you say, it still doesn't address the issue of loading the button images or changing keybindings. --- /home/james/src/emacs/lisp/tab-bar.el 2020-06-20 10:16:57.177037735 -0400 +++ /home/james/tmp/tab-bar.el 2020-06-28 20:15:46.073203151 -0400 @@ -799,11 +799,14 @@ (run-hook-with-args 'tab-bar-tab-post-open-functions (nth to-index tabs))) - (when (and (not tab-bar-mode) - (or (eq tab-bar-show t) - (and (natnump tab-bar-show) - (> (length tabs) tab-bar-show)))) + (cond + (tab-bar-mode) + ((eq tab-bar-show t) (tab-bar-mode 1)) + ((and (natnump tab-bar-show) + (> (length (funcall tab-bar-tabs-function)) tab-bar-show) + (zerop (frame-parameter nil 'tab-bar-lines))) + (set-frame-parameter nil 'tab-bar-lines 1))) (force-mode-line-update) (unless tab-bar-mode @@ -936,10 +939,11 @@ tab-bar-closed-tabs) (set-frame-parameter nil 'tabs (delq close-tab tabs))) - (when (and tab-bar-mode - (and (natnump tab-bar-show) - (<= (length tabs) tab-bar-show))) - (tab-bar-mode -1)) + (when (and (not (zerop (frame-parameter nil 'tab-bar-lines))) + (natnump tab-bar-show) + (<= (length (funcall tab-bar-tabs-function)) + tab-bar-show)) + (set-frame-parameter nil 'tab-bar-lines 0)) (force-mode-line-update) (unless tab-bar-mode @@ -975,10 +979,11 @@ (run-hook-with-args 'tab-bar-tab-pre-close-functions (nth index tabs) nil))) (set-frame-parameter nil 'tabs (list (nth current-index tabs))) - (when (and tab-bar-mode - (and (natnump tab-bar-show) - (<= 1 tab-bar-show))) - (tab-bar-mode -1)) + (when (and (not (zerop (frame-parameter nil 'tab-bar-lines))) + (natnump tab-bar-show) + (<= (length (funcall tab-bar-tabs-function)) + tab-bar-show)) + (set-frame-parameter nil 'tab-bar-lines 0)) (force-mode-line-update) (unless tab-bar-mode