unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
@ 2024-07-01 20:42 Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-07-02  6:55 ` Juri Linkov
  0 siblings, 1 reply; 25+ messages in thread
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-01 20:42 UTC (permalink / raw)
  To: 71883; +Cc: Adam Porter, Ship Mints

[-- Attachment #1: Type: text/plain, Size: 724 bytes --]

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

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-"))

Thank you!!

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Auto-resize-based-on-keymap-symbol-not-face.patch --]
[-- Type: text/x-diff, Size: 1586 bytes --]

From 4d3f43bfeb0d13a127d161fa9c3bd1737eafe645 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Mon, 1 Jul 2024 13:34:06 -0700
Subject: [PATCH] Auto resize based on keymap symbol, not face

* lisp/tab-bar.el (tab-bar-auto-width-faces): Remove defvar.
(tab-bar-auto-width): Match against symbol-name.
---
 lisp/tab-bar.el | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index edec6543a82..f2034616b06 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1216,12 +1216,6 @@ tab-bar-auto-width-min
 It's not recommended to change this value since with larger values, the
 tab bar might wrap to the second line when it shouldn't.")
 
-(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.")
-
 (defvar tab-bar--auto-width-hash nil
   "Memoization table for `tab-bar-auto-width'.")
 
@@ -1250,8 +1244,8 @@ tab-bar-auto-width
         (width 0))    ;; resize tab names to this width
     (dolist (item items)
       (when (and (eq (nth 1 item) 'menu-item) (stringp (nth 2 item)))
-        (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)))
             (push item tabs)
           (unless (eq (nth 0 item) 'align-right)
             (setq non-tabs (concat non-tabs (nth 2 item)))))))
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2024-08-20  7:11 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-01 20:42 bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-02  6:55 ` Juri Linkov
2024-07-02 13:42   ` Ship Mints
2024-07-02 16:25   ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-02 17:34     ` Juri Linkov
2024-07-02 23:10       ` Adam Porter
2024-07-03  6:27         ` Juri Linkov
2024-07-03 19:50           ` Adam Porter
2024-07-04 17:57             ` Juri Linkov
2024-07-04 21:11               ` Ship Mints
2024-07-16  5:12               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-17 11:18                 ` Eli Zaretskii
2024-07-19  6:42                   ` Juri Linkov
2024-07-25 18:11                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-25 18:18                       ` Juri Linkov
2024-07-25 18:52                         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-25 19:09                       ` Eli Zaretskii
2024-07-25 23:00                         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-06  6:59                           ` Juri Linkov
2024-08-09 12:15                             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-09 12:25                             ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-19 16:57                               ` Juri Linkov
2024-08-20  1:49                                 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-20  6:40                                   ` Juri Linkov
2024-08-20  7:11                                     ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).