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#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function Date: Tue, 02 Jul 2024 09:55:08 +0300 Organization: LINKOV.NET Message-ID: <861q4ce1yb.fsf@mail.linkov.net> References: <87le2kaloz.fsf@breatheoutbreathe.in> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26060"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: adam@alphapapa.net, shipmints@gmail.com, joseph@breatheoutbreathe.in To: 71883@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 02 09:00:21 2024 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 1sOXUx-0006ZV-N2 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 02 Jul 2024 09:00:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sOXUh-0004v7-7s; Tue, 02 Jul 2024 03:00:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOXUf-0004sY-5W for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2024 03:00:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sOXUe-0003Go-Tm for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2024 03:00:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sOXUf-0007JG-QS for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2024 03:00:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Jul 2024 07:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71883 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: Joseph Turner via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: 71883@debbugs.gnu.org, Adam Porter , Ship Mints , Joseph Turner Original-Received: via spool by submit@debbugs.gnu.org id=B.171990355328007 (code B ref -1); Tue, 02 Jul 2024 07:00:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Jul 2024 06:59:13 +0000 Original-Received: from localhost ([127.0.0.1]:35740 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOXTs-0007Ha-Vn for submit@debbugs.gnu.org; Tue, 02 Jul 2024 02:59:13 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:38274) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOXTr-0007HT-QN for submit@debbugs.gnu.org; Tue, 02 Jul 2024 02:59:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOXTp-0003q4-WF for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2024 02:59:10 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOXTo-0002V4-0c for bug-gnu-emacs@gnu.org; Tue, 02 Jul 2024 02:59:09 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 4313020004; Tue, 2 Jul 2024 06:59:01 +0000 (UTC) In-Reply-To: <87le2kaloz.fsf@breatheoutbreathe.in> (Joseph Turner via's message of "Mon, 01 Jul 2024 13:42:20 -0700") X-GND-Sasl: juri@linkov.net Received-SPF: pass client-ip=217.70.183.200; envelope-from=juri@linkov.net; helo=relay7-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288281 Archived-At: > The function tab-bar-auto-width determines which tabs to automatically > resize based on the face applied to each tab's text. If the face is one > of tab-bar-auto-width-faces, then the tab gets resized. However, if > either tab-bar-tab-face-function or tab-bar-tab-group-face-function is > set to a function which does not apply one of tab-bar-auto-width-faces, > then the tabs which have a different face are not auto resized. > > A real-world example of this issue is in activities.el: > > https://github.com/alphapapa/activities.el/issues/76 Thanks for the request. Maybe activities.el could add its face to tab-bar-auto-width-faces? If not, then what about allowing tab-bar-auto-width-faces to have the value t that means that all tabs should be resized regardless of what faces they have. > In the proposed patch, instead of checking each tab's face, we check > that the symbol at the start of each tab keymap matches > > (rx bos (or "current-tab" "tab-" "group-")) > -(defvar tab-bar-auto-width-faces > - '( tab-bar-tab tab-bar-tab-inactive > - tab-bar-tab-ungrouped > - tab-bar-tab-group-inactive) > - "Resize tabs only with these faces.") Sorry, we can't remove the existing variable to not break user configs. > @@ -1250,8 +1244,8 @@ tab-bar-auto-width > - (if (memq (get-text-property 0 'face (nth 2 item)) > - tab-bar-auto-width-faces) > + (if (string-match-p "\\`\\(?:current-tab\\|\\(?:group\\|tab\\)-\\)" > + (symbol-name (nth 0 item))) Matching the symbol name with the hard-coded regexp doesn't look right. Maybe better to add a new variable that contains a predicate function? When it returns t then resize.