all messages for Emacs-related lists mirrored at yhetil.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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  0 siblings, 2 replies; 25+ messages in thread
From: Juri Linkov @ 2024-07-02  6:55 UTC (permalink / raw
  To: 71883; +Cc: adam, shipmints, joseph

> 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.





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  1 sibling, 0 replies; 25+ messages in thread
From: Ship Mints @ 2024-07-02 13:42 UTC (permalink / raw
  To: Juri Linkov; +Cc: 71883, adam, joseph

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

I like both ideas. Supporting t seems idiomatic. `activities' could add its
face to the list, or a user in her configuration via documentation.

On Tue, Jul 2, 2024 at 2:59 AM Juri Linkov <juri@linkov.net> wrote:

> > 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.
>

[-- Attachment #2: Type: text/html, Size: 2693 bytes --]

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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  1 sibling, 1 reply; 25+ messages in thread
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-02 16:25 UTC (permalink / raw
  To: Juri Linkov; +Cc: 71883, adam, shipmints

Juri Linkov <juri@linkov.net> writes:

>> 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?

Unfortunately, this isn't possible.  activities.el sets
tab-bar-tab-face-function to

(defun activities-tabs--tab-bar-tab-face-function (tab)
  "Return a face for TAB.
If TAB represents an activity, face `activities-tabs' is added as
inherited."
  ;; TODO: Propose a tab-bar equivalent of `tab-line-tab-face-functions'.
  (let ((face (funcall activities-tabs-tab-bar-tab-face-function-original tab)))
    (if (activities-tabs--tab-parameter 'activity tab)
        `(:inherit (activities-tabs ,face))
      face)))

so there's no face symbol to match against.

> 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.

Would you be willing to send a patch with this idea?

>> 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.

You're right.

>> @@ -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.

What would be passed to the predicate function?

Thanks for the review!

Joseph





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Juri Linkov @ 2024-07-02 17:34 UTC (permalink / raw
  To: Joseph Turner; +Cc: 71883, Adam Porter, Ship Mints

>> 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.
>
> Would you be willing to send a patch with this idea?

Probably this is not needed after implementing a variable with
a predicate function, since it could be set to 'always' to return t.

Then activities.el could set this to a function that checks for a symbol.

>>> 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.
>
> You're right.

But we could deprecate tab-bar-auto-width-faces in Emacs 30,
and in Emacs 31 replace it with a function that matches a symbol name
like in your patch.  Then users will have time to get the function into use.

>>> @@ -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.
>
> What would be passed to the predicate function?

I think only 'item' should be passed to the function,
there is no other useful information here.

Then in Emacs 30 this function could check for a face name
in (nth 2 item), and in Emacs 31 a symbol name in (nth 0 item).

But only if a symbol name covers all cases currently supported
by the face name.  Let's see with the face->symbol mapping:

  tab-bar-tab -> current-tab
  tab-bar-tab-inactive -> tab-N
  tab-bar-tab-ungrouped -> tab-N, unfortunately there is no separate symbol
  tab-bar-tab-group-inactive -> group-N
  tab-bar-tab-group-current -> there is no current-group, but this could be added:

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index edec6543a82..66fb9490ce8 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1044,7 +1044,7 @@ tab-bar--format-tab-group
 when the tab is current.  Return the result as a keymap."
   (append
    `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore))
-   `((,(intern (format "group-%i" i))
+   `((,(intern (if current-p "current-group" (format "group-%i" i)))
       menu-item
       ,(if current-p
            (condition-case nil





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  2024-07-02 17:34     ` Juri Linkov
@ 2024-07-02 23:10       ` Adam Porter
  2024-07-03  6:27         ` Juri Linkov
  0 siblings, 1 reply; 25+ messages in thread
From: Adam Porter @ 2024-07-02 23:10 UTC (permalink / raw
  To: Juri Linkov, Joseph Turner; +Cc: 71883, Ship Mints

Thanks to all for working on this.

On 7/2/24 12:34, Juri Linkov wrote:
> Probably this is not needed after implementing a variable with
> a predicate function, since it could be set to 'always' to return t.
> 
> Then activities.el could set this to a function that checks for a symbol.

If it seems appropriate, I'd suggest using a list of predicate 
functions, which could be used with `run-hook-with-args-until-success'. 
That way there wouldn't be any contention with other libraries which 
also wanted to set that function.





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  2024-07-02 23:10       ` Adam Porter
@ 2024-07-03  6:27         ` Juri Linkov
  2024-07-03 19:50           ` Adam Porter
  0 siblings, 1 reply; 25+ messages in thread
From: Juri Linkov @ 2024-07-03  6:27 UTC (permalink / raw
  To: Adam Porter; +Cc: 71883, Ship Mints, Joseph Turner

>> Probably this is not needed after implementing a variable with
>> a predicate function, since it could be set to 'always' to return t.
>> Then activities.el could set this to a function that checks for a symbol.
>
> If it seems appropriate, I'd suggest using a list of predicate functions,
> which could be used with `run-hook-with-args-until-success'. That way there
> wouldn't be any contention with other libraries which also wanted to set
> that function.

Would you agree to use add-function instead?  For example, in tab-bar.el:

  (defvar tab-bar-auto-width-predicate #'tab-bar-auto-width-faces)

Then in activities.el you could use:

  (add-function :after-while tab-bar-auto-width-predicate activities-predicate)





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  2024-07-03  6:27         ` Juri Linkov
@ 2024-07-03 19:50           ` Adam Porter
  2024-07-04 17:57             ` Juri Linkov
  0 siblings, 1 reply; 25+ messages in thread
From: Adam Porter @ 2024-07-03 19:50 UTC (permalink / raw
  To: Juri Linkov; +Cc: 71883, Ship Mints, Joseph Turner

On 7/3/24 01:27, Juri Linkov wrote:
>>> Probably this is not needed after implementing a variable with
>>> a predicate function, since it could be set to 'always' to return t.
>>> Then activities.el could set this to a function that checks for a symbol.
>>
>> If it seems appropriate, I'd suggest using a list of predicate functions,
>> which could be used with `run-hook-with-args-until-success'. That way there
>> wouldn't be any contention with other libraries which also wanted to set
>> that function.
> 
> Would you agree to use add-function instead?  For example, in tab-bar.el:
> 
>    (defvar tab-bar-auto-width-predicate #'tab-bar-auto-width-faces)
> 
> Then in activities.el you could use:
> 
>    (add-function :after-while tab-bar-auto-width-predicate activities-predicate)

Isn't advice generally intended for users to use in their configs, 
rather than for libraries to use?  If we have here an opportunity to 
design an API that is extensible by multiple libraries, wouldn't that be 
preferable to asking downstream libraries to apply multiple levels of 
advice and the problems that would raise?

IOW, what would the problem be with using 
`run-hook-with-args-until-success' on a list of functions?  If there is 
one, I must be missing something.  :)





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  0 siblings, 2 replies; 25+ messages in thread
From: Juri Linkov @ 2024-07-04 17:57 UTC (permalink / raw
  To: Adam Porter; +Cc: 71883, Ship Mints, Joseph Turner

>>>> Probably this is not needed after implementing a variable with
>>>> a predicate function, since it could be set to 'always' to return t.
>>>> Then activities.el could set this to a function that checks for a symbol.
>>>
>>> If it seems appropriate, I'd suggest using a list of predicate functions,
>>> which could be used with `run-hook-with-args-until-success'. That way there
>>> wouldn't be any contention with other libraries which also wanted to set
>>> that function.
>> Would you agree to use add-function instead?  For example, in tab-bar.el:
>>    (defvar tab-bar-auto-width-predicate #'tab-bar-auto-width-faces)
>> Then in activities.el you could use:
>>    (add-function :after-while tab-bar-auto-width-predicate
>> activities-predicate)
>
> Isn't advice generally intended for users to use in their configs, rather
> than for libraries to use?  If we have here an opportunity to design an API
> that is extensible by multiple libraries, wouldn't that be preferable to
> asking downstream libraries to apply multiple levels of advice and the
> problems that would raise?
>
> IOW, what would the problem be with using
> `run-hook-with-args-until-success' on a list of functions?  If there is
> one, I must be missing something.  :)

Advice is intended for users and external libraries.
Only in core it should be avoided.

But `run-hook-with-args-until-success' is fine with me too.

Let's see what Joseph and Stephane think.





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  1 sibling, 0 replies; 25+ messages in thread
From: Ship Mints @ 2024-07-04 21:11 UTC (permalink / raw
  To: Juri Linkov; +Cc: Adam Porter, 71883, Joseph Turner

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

Seems reasonable and thank you for soliciting my input. You're the expert
with tab-bar, I'm just a happy minor contributor. I do have
activities/tab-bar UI features I use and don't want to break. Relevant to
this particular discussion, I rely on activities-tabs face to visually
differentiate activities-controlled tabs (I put a one-pixel box around the
tab).

I do similar things for tabs under other control regimes and have
customized formatters for groups and tabs for both colors and content
(prefixes for group names, prefixes for tab names that have "project"
buffers). And lots of customization around general usage; e.g., you know
about the work I did on optionally collapsing tab group members (Emacs 31!).

-S

On Thu, Jul 4, 2024 at 2:04 PM Juri Linkov <juri@linkov.net> wrote:

> >>>> Probably this is not needed after implementing a variable with
> >>>> a predicate function, since it could be set to 'always' to return t.
> >>>> Then activities.el could set this to a function that checks for a
> symbol.
> >>>
> >>> If it seems appropriate, I'd suggest using a list of predicate
> functions,
> >>> which could be used with `run-hook-with-args-until-success'. That way
> there
> >>> wouldn't be any contention with other libraries which also wanted to
> set
> >>> that function.
> >> Would you agree to use add-function instead?  For example, in
> tab-bar.el:
> >>    (defvar tab-bar-auto-width-predicate #'tab-bar-auto-width-faces)
> >> Then in activities.el you could use:
> >>    (add-function :after-while tab-bar-auto-width-predicate
> >> activities-predicate)
> >
> > Isn't advice generally intended for users to use in their configs, rather
> > than for libraries to use?  If we have here an opportunity to design an
> API
> > that is extensible by multiple libraries, wouldn't that be preferable to
> > asking downstream libraries to apply multiple levels of advice and the
> > problems that would raise?
> >
> > IOW, what would the problem be with using
> > `run-hook-with-args-until-success' on a list of functions?  If there is
> > one, I must be missing something.  :)
>
> Advice is intended for users and external libraries.
> Only in core it should be avoided.
>
> But `run-hook-with-args-until-success' is fine with me too.
>
> Let's see what Joseph and Stephane think.
>

[-- Attachment #2: Type: text/html, Size: 2922 bytes --]

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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  1 sibling, 1 reply; 25+ messages in thread
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-16  5:12 UTC (permalink / raw
  To: Juri Linkov; +Cc: Adam Porter, 71883, Ship Mints

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

Juri Linkov <juri@linkov.net> writes:

> Let's see what Joseph and Stephane think.

Please see the attached patches, where the first three commits are
intended to be applied to the emacs-30 branch, and the final commit
removes the obsolete `tab-bar-auto-width-faces' on master.

Does this change warrant a NEWS entry?

Thanks!

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-current-group-symbol-for-current-tab-group-item.patch --]
[-- Type: text/x-diff, Size: 858 bytes --]

From 050a574bcab371ee87b1ed6c15e6431a3c2ed4d8 Mon Sep 17 00:00:00 2001
From: Juri Linkov <juri@linkov.net>
Date: Mon, 15 Jul 2024 21:23:39 -0700
Subject: [PATCH 1/4] Use current-group symbol for current tab group item

* lisp/tab-bar.el (tab-bar--format-tab-group):
---
 lisp/tab-bar.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index edec6543a82..66fb9490ce8 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1044,7 +1044,7 @@ tab-bar--format-tab-group
 when the tab is current.  Return the result as a keymap."
   (append
    `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore))
-   `((,(intern (format "group-%i" i))
+   `((,(intern (if current-p "current-group" (format "group-%i" i)))
       menu-item
       ,(if current-p
            (condition-case nil
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Add-abnormal-hook-to-determine-which-tabs-to-auto-wi.patch --]
[-- Type: text/x-diff, Size: 2219 bytes --]

From ca66acf2a4ded69e07a796d3feb1906072c20e6c Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Mon, 15 Jul 2024 21:55:35 -0700
Subject: [PATCH 2/4] Add abnormal hook to determine which tabs to auto-widen

* lisp/tab-bar.el (tab-bar-auto-width-predicate-default):  Default value
for tab-bar-auto-width-functions.
(tab-bar-auto-width-functions): New abnormal hook.
(tab-bar-auto-width): Run new abnormal hook until success instead of
comparing text properties on Emacs 31 or later.
---
 lisp/tab-bar.el | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 66fb9490ce8..86259f36df5 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1222,6 +1222,18 @@ tab-bar-auto-width-faces
      tab-bar-tab-group-inactive)
   "Resize tabs only with these faces.")
 
+(defun tab-bar-auto-width-predicate-default (item)
+  "Accepts tab ITEM and returns non-nil for tabs and tab groups."
+  (string-match-p
+   ;; (rx bos (or "current-tab" "current-group" "tab-" "group-"))
+   "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)"
+   (symbol-name (nth 0 item))))
+
+(defvar tab-bar-auto-width-functions '(tab-bar-auto-width-predicate-default)
+  "List of functions for `tab-bar-auto-width' to call with a tab ITEM.
+If any of these functions returns non-nil for a given tab ITEM, that
+tab's width will be auto-sized.")
+
 (defvar tab-bar--auto-width-hash nil
   "Memoization table for `tab-bar-auto-width'.")
 
@@ -1250,8 +1262,10 @@ 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 (if (version<= "31" emacs-version)
+                (run-hook-with-args-until-success 'tab-bar-auto-width-functions item)
+              (memq (get-text-property 0 'face (nth 2 item))
+                    tab-bar-auto-width-faces))
             (push item tabs)
           (unless (eq (nth 0 item) 'align-right)
             (setq non-tabs (concat non-tabs (nth 2 item)))))))
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Mark-tab-bar-auto-width-faces-obsolete.patch --]
[-- Type: text/x-diff, Size: 853 bytes --]

From 89c7c43219569df5d78a3677aeff7f5e20d83330 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Mon, 15 Jul 2024 22:05:40 -0700
Subject: [PATCH 3/4] Mark tab-bar-auto-width-faces obsolete

* lisp/tab-bar.el: (tab-bar-auto-width-faces) Obsolete on >=30.
---
 lisp/tab-bar.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 86259f36df5..853f487743d 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1216,6 +1216,7 @@ 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.")
 
+(make-obsolete-variable 'tab-bar-auto-width-faces 'tab-bar-auto-width-functions "30")
 (defvar tab-bar-auto-width-faces
   '( tab-bar-tab tab-bar-tab-inactive
      tab-bar-tab-ungrouped
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-Remove-obsolete-tab-bar-auto-width-faces.patch --]
[-- Type: text/x-diff, Size: 1820 bytes --]

From fa939a20ad4752bdf6d591b09ec69e14981aa714 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Mon, 15 Jul 2024 22:07:22 -0700
Subject: [PATCH 4/4] Remove obsolete tab-bar-auto-width-faces

* lisp/tab-bar.el (tab-bar-auto-width-faces):  Remove.
(tab-bar-auto-width): Only run tab-bar-auto-width-functions.
---
 lisp/tab-bar.el | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 853f487743d..57ea78414bc 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1216,13 +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.")
 
-(make-obsolete-variable 'tab-bar-auto-width-faces 'tab-bar-auto-width-functions "30")
-(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.")
-
 (defun tab-bar-auto-width-predicate-default (item)
   "Accepts tab ITEM and returns non-nil for tabs and tab groups."
   (string-match-p
@@ -1263,10 +1256,7 @@ 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 (if (version<= "31" emacs-version)
-                (run-hook-with-args-until-success 'tab-bar-auto-width-functions item)
-              (memq (get-text-property 0 'face (nth 2 item))
-                    tab-bar-auto-width-faces))
+        (if (run-hook-with-args-until-success 'tab-bar-auto-width-functions 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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2024-07-17 11:18 UTC (permalink / raw
  To: Joseph Turner; +Cc: adam, 71883, shipmints, juri

> Cc: Adam Porter <adam@alphapapa.net>, 71883@debbugs.gnu.org,
>  Ship Mints <shipmints@gmail.com>
> Date: Mon, 15 Jul 2024 22:12:46 -0700
> From:  Joseph Turner via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Juri Linkov <juri@linkov.net> writes:
> 
> > Let's see what Joseph and Stephane think.
> 
> Please see the attached patches, where the first three commits are
> intended to be applied to the emacs-30 branch, and the final commit
> removes the obsolete `tab-bar-auto-width-faces' on master.

I'm not sure I understand why they need to be installed on emacs-30.
Is this a regression in Emacs 29 or Emacs 30?  What bad things will
happen if we install the changes on master instead>

> Does this change warrant a NEWS entry?

Yes, since you are adding a hook variable.  Obsolescence of a variable
also requires a NEWS entry.

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Date: Mon, 15 Jul 2024 22:07:22 -0700
> Subject: [PATCH 4/4] Remove obsolete tab-bar-auto-width-faces
> 
> * lisp/tab-bar.el (tab-bar-auto-width-faces):  Remove.
> (tab-bar-auto-width): Only run tab-bar-auto-width-functions.

We don't usually remove a variable one major release after it has been
obsoleted.  It's too soon.

Thanks.





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Juri Linkov @ 2024-07-19  6:42 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: adam, 71883, shipmints, Joseph Turner

>> Please see the attached patches, where the first three commits are
>> intended to be applied to the emacs-30 branch, and the final commit
>> removes the obsolete `tab-bar-auto-width-faces' on master.

Thanks for the patches, although I agree with Eli that the changes
on emacs-30 should be minimal.

> I'm not sure I understand why they need to be installed on emacs-30.
> Is this a regression in Emacs 29 or Emacs 30?  What bad things will
> happen if we install the changes on master instead>

Replacing hard-coded logic with customizable variable
for external packages like activities.el is needed
as soon as possible on emacs-30 because hard-coded logic
hinders the use of packages.

However, there is no hurry to change the default behavior
to match a symbol name instead of checking face names.
Therefore I think better to move the existing code

  (memq (get-text-property 0 'face (nth 2 item)) tab-bar-auto-width-faces)

to the new predicate function on emacs-30.  Then activities.el
can change it to another function that matches a symbol.

Then on master the default body on the new predicate
could be replaced from checking the face to match a symbol.
Also changes in tab-bar--format-tab-group should be on master as well.

>> Does this change warrant a NEWS entry?
>
> Yes, since you are adding a hook variable.  Obsolescence of a variable
> also requires a NEWS entry.

Then addition of tab-bar-auto-width-functions requires a NEWS entry on emacs-30.
And obsolescence of tab-bar-auto-width-faces requires a NEWS entry on master.

>> * lisp/tab-bar.el (tab-bar-auto-width-faces):  Remove.
>> (tab-bar-auto-width): Only run tab-bar-auto-width-functions.
>
> We don't usually remove a variable one major release after it has been
> obsoleted.  It's too soon.

Indeed, it could be obsoleted on master.
This will provide a minimal set of changes on emacs-30.





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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 19:09                       ` Eli Zaretskii
  0 siblings, 2 replies; 25+ messages in thread
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-25 18:11 UTC (permalink / raw
  To: Juri Linkov; +Cc: adam, 71883, Eli Zaretskii, shipmints

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

Juri Linkov <juri@linkov.net> writes:

>> I'm not sure I understand why they need to be installed on emacs-30.
>> Is this a regression in Emacs 29 or Emacs 30?  What bad things will
>> happen if we install the changes on master instead>

No regression.

> Replacing hard-coded logic with customizable variable
> for external packages like activities.el is needed
> as soon as possible on emacs-30 because hard-coded logic
> hinders the use of packages.
>
> However, there is no hurry to change the default behavior
> to match a symbol name instead of checking face names.
> Therefore I think better to move the existing code
>
>   (memq (get-text-property 0 'face (nth 2 item)) tab-bar-auto-width-faces)
>
> to the new predicate function on emacs-30.  Then activities.el
> can change it to another function that matches a symbol.
>
> Then on master the default body on the new predicate
> could be replaced from checking the face to match a symbol.
> Also changes in tab-bar--format-tab-group should be on master as well.

Much as I'd like to use these changes asap, I think this patchset should
go entirely on master.  I see these changes as adding functionality
(making tab-bar tabs more extensible) rather than bug fixes.

>>> Does this change warrant a NEWS entry?
>>
>> Yes, since you are adding a hook variable.  Obsolescence of a variable
>> also requires a NEWS entry.

Please see attached patches.

Thanks!

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-current-group-symbol-for-current-tab-group-item.patch --]
[-- Type: text/x-diff, Size: 858 bytes --]

From 050a574bcab371ee87b1ed6c15e6431a3c2ed4d8 Mon Sep 17 00:00:00 2001
From: Juri Linkov <juri@linkov.net>
Date: Mon, 15 Jul 2024 21:23:39 -0700
Subject: [PATCH 1/4] Use current-group symbol for current tab group item

* lisp/tab-bar.el (tab-bar--format-tab-group):
---
 lisp/tab-bar.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index edec6543a82..66fb9490ce8 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1044,7 +1044,7 @@ tab-bar--format-tab-group
 when the tab is current.  Return the result as a keymap."
   (append
    `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore))
-   `((,(intern (format "group-%i" i))
+   `((,(intern (if current-p "current-group" (format "group-%i" i)))
       menu-item
       ,(if current-p
            (condition-case nil
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Add-abnormal-hook-to-determine-which-tabs-to-auto-wi.patch --]
[-- Type: text/x-diff, Size: 2032 bytes --]

From f85b67595b91f90fdd96231d18b73edcf96c30be Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Mon, 15 Jul 2024 21:55:35 -0700
Subject: [PATCH 2/4] Add abnormal hook to determine which tabs to auto-widen

* lisp/tab-bar.el (tab-bar-auto-width-predicate-default):  Default value
for tab-bar-auto-width-functions.
(tab-bar-auto-width-functions): New abnormal hook.
(tab-bar-auto-width): Run new abnormal hook until success instead of
comparing text properties.
---
 lisp/tab-bar.el | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 66fb9490ce8..9ad59339aa1 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1222,6 +1222,18 @@ tab-bar-auto-width-faces
      tab-bar-tab-group-inactive)
   "Resize tabs only with these faces.")
 
+(defun tab-bar-auto-width-predicate-default (item)
+  "Accepts tab ITEM and returns non-nil for tabs and tab groups."
+  (string-match-p
+   ;; (rx bos (or "current-tab" "current-group" "tab-" "group-"))
+   "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)"
+   (symbol-name (nth 0 item))))
+
+(defvar tab-bar-auto-width-functions '(tab-bar-auto-width-predicate-default)
+  "List of functions for `tab-bar-auto-width' to call with a tab ITEM.
+If any of these functions returns non-nil for a given tab ITEM, that
+tab's width will be auto-sized.")
+
 (defvar tab-bar--auto-width-hash nil
   "Memoization table for `tab-bar-auto-width'.")
 
@@ -1250,8 +1262,7 @@ 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 (run-hook-with-args-until-success 'tab-bar-auto-width-functions item)
             (push item tabs)
           (unless (eq (nth 0 item) 'align-right)
             (setq non-tabs (concat non-tabs (nth 2 item)))))))
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Mark-tab-bar-auto-width-faces-obsolete.patch --]
[-- Type: text/x-diff, Size: 853 bytes --]

From f4419f46ab96476537fe377baf5950bb8ef22b83 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Mon, 15 Jul 2024 22:05:40 -0700
Subject: [PATCH 3/4] Mark tab-bar-auto-width-faces obsolete

* lisp/tab-bar.el: (tab-bar-auto-width-faces) Obsolete on >=30.
---
 lisp/tab-bar.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 9ad59339aa1..503df82539d 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1216,6 +1216,7 @@ 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.")
 
+(make-obsolete-variable 'tab-bar-auto-width-faces 'tab-bar-auto-width-functions "30")
 (defvar tab-bar-auto-width-faces
   '( tab-bar-tab tab-bar-tab-inactive
      tab-bar-tab-ungrouped
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-etc-NEWS-Announce-tab-bar-auto-width-functions.patch --]
[-- Type: text/x-diff, Size: 823 bytes --]

From 1d677b03e1ebb38b8287adf1a6cc4fe5ab4712b2 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Thu, 25 Jul 2024 10:58:38 -0700
Subject: [PATCH 4/4] ; * etc/NEWS: Announce tab-bar-auto-width-functions

---
 etc/NEWS | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 5c08bc7550f..300b79c50b2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -30,6 +30,14 @@ applies, and please also update docstrings as needed.
 \f
 * Changes in Emacs 31.1
 
+** Tab Bars and Tab Lines
+
+*** New abnormal hook 'tab-bar-auto-width-functions'.  This hook
+allows you to control which tab-bar tabs are automatically resized.
+
+*** The 'tab-bar-auto-width-faces' variable is now obsolete.
+Use 'tab-bar-auto-width-functions' instead.
+
 \f
 * Editing Changes in Emacs 31.1
 
-- 
2.41.0


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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  1 sibling, 1 reply; 25+ messages in thread
From: Juri Linkov @ 2024-07-25 18:18 UTC (permalink / raw
  To: Joseph Turner; +Cc: adam, 71883, Eli Zaretskii, shipmints

>> Replacing hard-coded logic with customizable variable
>> for external packages like activities.el is needed
>> as soon as possible on emacs-30 because hard-coded logic
>> hinders the use of packages.
>>
>> However, there is no hurry to change the default behavior
>> to match a symbol name instead of checking face names.
>> Therefore I think better to move the existing code
>>
>>   (memq (get-text-property 0 'face (nth 2 item)) tab-bar-auto-width-faces)
>>
>> to the new predicate function on emacs-30.  Then activities.el
>> can change it to another function that matches a symbol.
>>
>> Then on master the default body on the new predicate
>> could be replaced from checking the face to match a symbol.
>> Also changes in tab-bar--format-tab-group should be on master as well.
>
> Much as I'd like to use these changes asap, I think this patchset should
> go entirely on master.  I see these changes as adding functionality
> (making tab-bar tabs more extensible) rather than bug fixes.

Are you sure there is no hurry to make tab-bar more extensible
for activities.el?  Then let's push to master for Emacs 31.





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  0 siblings, 0 replies; 25+ messages in thread
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-25 18:52 UTC (permalink / raw
  To: Juri Linkov; +Cc: adam, 71883, Eli Zaretskii, shipmints

Juri Linkov <juri@linkov.net> writes:

>>> Replacing hard-coded logic with customizable variable
>>> for external packages like activities.el is needed
>>> as soon as possible on emacs-30 because hard-coded logic
>>> hinders the use of packages.
>>>
>>> However, there is no hurry to change the default behavior
>>> to match a symbol name instead of checking face names.
>>> Therefore I think better to move the existing code
>>>
>>>   (memq (get-text-property 0 'face (nth 2 item)) tab-bar-auto-width-faces)
>>>
>>> to the new predicate function on emacs-30.  Then activities.el
>>> can change it to another function that matches a symbol.
>>>
>>> Then on master the default body on the new predicate
>>> could be replaced from checking the face to match a symbol.
>>> Also changes in tab-bar--format-tab-group should be on master as well.
>>
>> Much as I'd like to use these changes asap, I think this patchset should
>> go entirely on master.  I see these changes as adding functionality
>> (making tab-bar tabs more extensible) rather than bug fixes.
>
> Are you sure there is no hurry to make tab-bar more extensible
> for activities.el?  Then let's push to master for Emacs 31.

The effect on activities.el is purely cosmetic.  I think it's fine to
wait for 31.

Thanks for thinking it through together with me!

Joseph





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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 19:09                       ` Eli Zaretskii
  2024-07-25 23:00                         ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2024-07-25 19:09 UTC (permalink / raw
  To: Joseph Turner; +Cc: adam, 71883, shipmints, juri

> From: Joseph Turner <joseph@breatheoutbreathe.in>
> Cc: Eli Zaretskii <eliz@gnu.org>,  adam@alphapapa.net,
>   71883@debbugs.gnu.org,  shipmints@gmail.com
> Date: Thu, 25 Jul 2024 11:11:01 -0700
> 
> +** Tab Bars and Tab Lines
> +
> +*** New abnormal hook 'tab-bar-auto-width-functions'.  This hook
> +allows you to control which tab-bar tabs are automatically resized.

The first line should be a single complete sentence.





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  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-25 23:00 UTC (permalink / raw
  To: Eli Zaretskii; +Cc: adam, 71883, shipmints, juri

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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joseph Turner <joseph@breatheoutbreathe.in>
>> Cc: Eli Zaretskii <eliz@gnu.org>,  adam@alphapapa.net,
>>   71883@debbugs.gnu.org,  shipmints@gmail.com
>> Date: Thu, 25 Jul 2024 11:11:01 -0700
>> 
>> +** Tab Bars and Tab Lines
>> +
>> +*** New abnormal hook 'tab-bar-auto-width-functions'.  This hook
>> +allows you to control which tab-bar tabs are automatically resized.
>
> The first line should be a single complete sentence.

Thanks!  See patches.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-current-group-symbol-for-current-tab-group-item.patch --]
[-- Type: text/x-diff, Size: 858 bytes --]

From 050a574bcab371ee87b1ed6c15e6431a3c2ed4d8 Mon Sep 17 00:00:00 2001
From: Juri Linkov <juri@linkov.net>
Date: Mon, 15 Jul 2024 21:23:39 -0700
Subject: [PATCH 1/4] Use current-group symbol for current tab group item

* lisp/tab-bar.el (tab-bar--format-tab-group):
---
 lisp/tab-bar.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index edec6543a82..66fb9490ce8 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1044,7 +1044,7 @@ tab-bar--format-tab-group
 when the tab is current.  Return the result as a keymap."
   (append
    `((,(intern (format "sep-%i" i)) menu-item ,(tab-bar-separator) ignore))
-   `((,(intern (format "group-%i" i))
+   `((,(intern (if current-p "current-group" (format "group-%i" i)))
       menu-item
       ,(if current-p
            (condition-case nil
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Add-abnormal-hook-to-determine-which-tabs-to-auto-wi.patch --]
[-- Type: text/x-diff, Size: 2032 bytes --]

From f85b67595b91f90fdd96231d18b73edcf96c30be Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Mon, 15 Jul 2024 21:55:35 -0700
Subject: [PATCH 2/4] Add abnormal hook to determine which tabs to auto-widen

* lisp/tab-bar.el (tab-bar-auto-width-predicate-default):  Default value
for tab-bar-auto-width-functions.
(tab-bar-auto-width-functions): New abnormal hook.
(tab-bar-auto-width): Run new abnormal hook until success instead of
comparing text properties.
---
 lisp/tab-bar.el | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 66fb9490ce8..9ad59339aa1 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1222,6 +1222,18 @@ tab-bar-auto-width-faces
      tab-bar-tab-group-inactive)
   "Resize tabs only with these faces.")
 
+(defun tab-bar-auto-width-predicate-default (item)
+  "Accepts tab ITEM and returns non-nil for tabs and tab groups."
+  (string-match-p
+   ;; (rx bos (or "current-tab" "current-group" "tab-" "group-"))
+   "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)"
+   (symbol-name (nth 0 item))))
+
+(defvar tab-bar-auto-width-functions '(tab-bar-auto-width-predicate-default)
+  "List of functions for `tab-bar-auto-width' to call with a tab ITEM.
+If any of these functions returns non-nil for a given tab ITEM, that
+tab's width will be auto-sized.")
+
 (defvar tab-bar--auto-width-hash nil
   "Memoization table for `tab-bar-auto-width'.")
 
@@ -1250,8 +1262,7 @@ 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 (run-hook-with-args-until-success 'tab-bar-auto-width-functions item)
             (push item tabs)
           (unless (eq (nth 0 item) 'align-right)
             (setq non-tabs (concat non-tabs (nth 2 item)))))))
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Mark-tab-bar-auto-width-faces-obsolete.patch --]
[-- Type: text/x-diff, Size: 853 bytes --]

From f4419f46ab96476537fe377baf5950bb8ef22b83 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Mon, 15 Jul 2024 22:05:40 -0700
Subject: [PATCH 3/4] Mark tab-bar-auto-width-faces obsolete

* lisp/tab-bar.el: (tab-bar-auto-width-faces) Obsolete on >=30.
---
 lisp/tab-bar.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 9ad59339aa1..503df82539d 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1216,6 +1216,7 @@ 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.")
 
+(make-obsolete-variable 'tab-bar-auto-width-faces 'tab-bar-auto-width-functions "30")
 (defvar tab-bar-auto-width-faces
   '( tab-bar-tab tab-bar-tab-inactive
      tab-bar-tab-ungrouped
-- 
2.41.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-etc-NEWS-Announce-tab-bar-auto-width-functions.patch --]
[-- Type: text/x-diff, Size: 813 bytes --]

From 7e63ee64297e1f8fdb161654d17516bfdb6eb527 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Thu, 25 Jul 2024 10:58:38 -0700
Subject: [PATCH 4/4] ; * etc/NEWS: Announce tab-bar-auto-width-functions

---
 etc/NEWS | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 5c08bc7550f..078573dd654 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -30,6 +30,14 @@ applies, and please also update docstrings as needed.
 \f
 * Changes in Emacs 31.1
 
+** Tab Bars and Tab Lines
+
+*** New abnormal hook 'tab-bar-auto-width-functions'.
+This hook allows you to control which tab-bar tabs are auto-resized.
+
+*** The 'tab-bar-auto-width-faces' variable is now obsolete.
+Use 'tab-bar-auto-width-functions' instead.
+
 \f
 * Editing Changes in Emacs 31.1
 
-- 
2.41.0


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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  0 siblings, 2 replies; 25+ messages in thread
From: Juri Linkov @ 2024-08-06  6:59 UTC (permalink / raw
  To: Joseph Turner; +Cc: adam, 71883, Eli Zaretskii, shipmints

Thanks for the patches.

> -   `((,(intern (format "group-%i" i))
> +   `((,(intern (if current-p "current-group" (format "group-%i" i)))

I pushed this part to master now.

> +(defun tab-bar-auto-width-predicate-default (item)
> +  "Accepts tab ITEM and returns non-nil for tabs and tab groups."
> +  (string-match-p
> +   ;; (rx bos (or "current-tab" "current-group" "tab-" "group-"))
> +   "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)"
> +   (symbol-name (nth 0 item))))

In this part please remove the current group from the default implementation,
because it looks too ugly, and it was not resized before this change, since
tab-bar-auto-width-faces didn't contain the tab-bar-tab-group-current face.

> -        (if (memq (get-text-property 0 'face (nth 2 item))
> -                  tab-bar-auto-width-faces)
> +        (if (run-hook-with-args-until-success 'tab-bar-auto-width-functions item)

I wonder how users are supposed to handle tab-bar-tab-ungrouped now?
Since it can't be distinguished from grouped tabs (both have tab- symbols),
is this how users should customize this now:

  (setq tab-bar-auto-width-functions
        `(,(lambda (item)
             (and (string-match-p
                   "\\`\\(?:current-tab\\|\\(?:group\\|tab\\)-\\)" (symbol-name (nth 0 item)))
                  (not (eq (get-text-property 0 'face (nth 2 item))
                           'tab-bar-tab-ungrouped))))))

> +(make-obsolete-variable 'tab-bar-auto-width-faces 'tab-bar-auto-width-functions "30")
> [...]
> +*** The 'tab-bar-auto-width-faces' variable is now obsolete.
> +Use 'tab-bar-auto-width-functions' instead.

Actually I see no need to obsolete the variable instead of deleting it right away
since it's not used anywhere anymore.





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  1 sibling, 0 replies; 25+ messages in thread
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-08-09 12:15 UTC (permalink / raw
  To: Juri Linkov; +Cc: adam, 71883, Eli Zaretskii, shipmints

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



On August 5, 2024 11:59:51 PM PDT, Juri Linkov <juri@linkov.net> wrote:
>Thanks for the patches.
>
>> -   `((,(intern (format "group-%i" i))
>> +   `((,(intern (if current-p "current-group" (format "group-%i" i)))
>
>I pushed this part to master now.
>
>> +(defun tab-bar-auto-width-predicate-default (item)
>> +  "Accepts tab ITEM and returns non-nil for tabs and tab groups."
>> +  (string-match-p
>> +   ;; (rx bos (or "current-tab" "current-group" "tab-" "group-"))
>> +   "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)"
>> +   (symbol-name (nth 0 item))))
>
>In this part please remove the current group from the default implementation,
>because it looks too ugly, and it was not resized before this change, since
>tab-bar-auto-width-faces didn't contain the tab-bar-tab-group-current face.

If the simpler change brings feature parity, go for it!

>> -        (if (memq (get-text-property 0 'face (nth 2 item))
>> -                  tab-bar-auto-width-faces)
>> +        (if (run-hook-with-args-until-success 'tab-bar-auto-width-functions item)
>
>I wonder how users are supposed to handle tab-bar-tab-ungrouped now?
>Since it can't be distinguished from grouped tabs (both have tab- symbols),
>is this how users should customize this now:
>
>  (setq tab-bar-auto-width-functions
>        `(,(lambda (item)
>             (and (string-match-p
>                   "\\`\\(?:current-tab\\|\\(?:group\\|tab\\)-\\)" (symbol-name (nth 0 item)))
>                  (not (eq (get-text-property 0 'face (nth 2 item))
>                           'tab-bar-tab-ungrouped))))))

I'm not sure.  I have never used group tabs.

>> +(make-obsolete-variable 'tab-bar-auto-width-faces 'tab-bar-auto-width-functions "30")
>> [...]
>> +*** The 'tab-bar-auto-width-faces' variable is now obsolete.
>> +Use 'tab-bar-auto-width-functions' instead.
>
>Actually I see no need to obsolete the variable instead of deleting it right away
>since it's not used anywhere anymore.

If it's okay to remove defvars without obsoletion notice, then I'm in favor of deleting it now.

Thanks!

Joseph

[-- Attachment #2: Type: text/html, Size: 2593 bytes --]

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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  1 sibling, 1 reply; 25+ messages in thread
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-08-09 12:25 UTC (permalink / raw
  To: Juri Linkov; +Cc: adam, 71883, Eli Zaretskii, shipmints

Juri Linkov <juri@linkov.net> writes:

> Thanks for the patches.
>
>> -   `((,(intern (format "group-%i" i))
>> +   `((,(intern (if current-p "current-group" (format "group-%i" i)))
>
> I pushed this part to master now.
>
>> +(defun tab-bar-auto-width-predicate-default (item)
>> +  "Accepts tab ITEM and returns non-nil for tabs and tab groups."
>> +  (string-match-p
>> +   ;; (rx bos (or "current-tab" "current-group" "tab-" "group-"))
>> +   "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)"
>> +   (symbol-name (nth 0 item))))
>
> In this part please remove the current group from the default implementation,
> because it looks too ugly, and it was not resized before this change, since
> tab-bar-auto-width-faces didn't contain the tab-bar-tab-group-current face.

If the simpler change offers feature parity, that sounds good to me.

>> -        (if (memq (get-text-property 0 'face (nth 2 item))
>> -                  tab-bar-auto-width-faces)
>> +        (if (run-hook-with-args-until-success 'tab-bar-auto-width-functions item)
>
> I wonder how users are supposed to handle tab-bar-tab-ungrouped now?
> Since it can't be distinguished from grouped tabs (both have tab- symbols),
> is this how users should customize this now:
>
>   (setq tab-bar-auto-width-functions
>         `(,(lambda (item)
>              (and (string-match-p
>                    "\\`\\(?:current-tab\\|\\(?:group\\|tab\\)-\\)" (symbol-name (nth 0 item)))
>                   (not (eq (get-text-property 0 'face (nth 2 item))
>                            'tab-bar-tab-ungrouped))))))

I don't use tab groups, so I don't know if anyone will want to do this.

>> +(make-obsolete-variable 'tab-bar-auto-width-faces 'tab-bar-auto-width-functions "30")
>> [...]
>> +*** The 'tab-bar-auto-width-faces' variable is now obsolete.
>> +Use 'tab-bar-auto-width-functions' instead.
>
> Actually I see no need to obsolete the variable instead of deleting it right away
> since it's not used anywhere anymore.

If it's okay to remove defvars without obsoletion, I'm in favor of it.

Thanks!

Joseph





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Juri Linkov @ 2024-08-19 16:57 UTC (permalink / raw
  To: Joseph Turner; +Cc: adam, 71883, Eli Zaretskii, shipmints

close 71883 31.0.50
thanks

>>> +(defun tab-bar-auto-width-predicate-default (item)
>>> +  "Accepts tab ITEM and returns non-nil for tabs and tab groups."
>>> +  (string-match-p
>>> +   ;; (rx bos (or "current-tab" "current-group" "tab-" "group-"))
>>> +   "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)"
>>> +   (symbol-name (nth 0 item))))
>>
>> In this part please remove the current group from the default implementation,
>> because it looks too ugly, and it was not resized before this change, since
>> tab-bar-auto-width-faces didn't contain the tab-bar-tab-group-current face.
>
> If the simpler change offers feature parity, that sounds good to me.

Thanks for the patch, I pushed it to master, then ameliorated it
to keep backwards-compatibility for users customized these faces,
but by default using your predicate on symbols.





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  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-08-20  1:49 UTC (permalink / raw
  To: Juri Linkov; +Cc: adam, 71883, Eli Zaretskii, shipmints

Juri Linkov <juri@linkov.net> writes:

> close 71883 31.0.50
> thanks
>
>>>> +(defun tab-bar-auto-width-predicate-default (item)
>>>> +  "Accepts tab ITEM and returns non-nil for tabs and tab groups."
>>>> +  (string-match-p
>>>> +   ;; (rx bos (or "current-tab" "current-group" "tab-" "group-"))
>>>> +   "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)"
>>>> +   (symbol-name (nth 0 item))))
>>>
>>> In this part please remove the current group from the default implementation,
>>> because it looks too ugly, and it was not resized before this change, since
>>> tab-bar-auto-width-faces didn't contain the tab-bar-tab-group-current face.
>>
>> If the simpler change offers feature parity, that sounds good to me.
>
> Thanks for the patch, I pushed it to master, then ameliorated it
> to keep backwards-compatibility for users customized these faces,
> but by default using your predicate on symbols.

Thank you!  How would users have customized tab-bar-auto-width-faces
since it was not a defcustom?





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Juri Linkov @ 2024-08-20  6:40 UTC (permalink / raw
  To: Joseph Turner; +Cc: adam, 71883, Eli Zaretskii, shipmints

>>>>> +(defun tab-bar-auto-width-predicate-default (item)
>>>>> +  "Accepts tab ITEM and returns non-nil for tabs and tab groups."
>>>>> +  (string-match-p
>>>>> +   ;; (rx bos (or "current-tab" "current-group" "tab-" "group-"))
>>>>> +   "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)"
>>>>> +   (symbol-name (nth 0 item))))
>>>>
>>>> In this part please remove the current group from the default implementation,
>>>> because it looks too ugly, and it was not resized before this change, since
>>>> tab-bar-auto-width-faces didn't contain the tab-bar-tab-group-current face.
>>>
>>> If the simpler change offers feature parity, that sounds good to me.
>>
>> Thanks for the patch, I pushed it to master, then ameliorated it
>> to keep backwards-compatibility for users customized these faces,
>> but by default using your predicate on symbols.
>
> Thank you!  How would users have customized tab-bar-auto-width-faces
> since it was not a defcustom?

I meant that customized it without using the Customization UI.
Maybe a better word would be "configured", e.g. with 'setopt'
('setopt' supports non-customizable plain variables as
'setq' does, unlike 'set-variable' that refuses to change them).





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

* bug#71883: [PATCH] Fix tab-bar-auto-width with customized tab-bar-tab-face-function
  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
  0 siblings, 0 replies; 25+ messages in thread
From: Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-08-20  7:11 UTC (permalink / raw
  To: Juri Linkov; +Cc: adam, 71883, Eli Zaretskii, shipmints

Juri Linkov <juri@linkov.net> writes:

>>>>>> +(defun tab-bar-auto-width-predicate-default (item)
>>>>>> +  "Accepts tab ITEM and returns non-nil for tabs and tab groups."
>>>>>> +  (string-match-p
>>>>>> +   ;; (rx bos (or "current-tab" "current-group" "tab-" "group-"))
>>>>>> +   "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)"
>>>>>> +   (symbol-name (nth 0 item))))
>>>>>
>>>>> In this part please remove the current group from the default implementation,
>>>>> because it looks too ugly, and it was not resized before this change, since
>>>>> tab-bar-auto-width-faces didn't contain the tab-bar-tab-group-current face.
>>>>
>>>> If the simpler change offers feature parity, that sounds good to me.
>>>
>>> Thanks for the patch, I pushed it to master, then ameliorated it
>>> to keep backwards-compatibility for users customized these faces,
>>> but by default using your predicate on symbols.
>>
>> Thank you!  How would users have customized tab-bar-auto-width-faces
>> since it was not a defcustom?
>
> I meant that customized it without using the Customization UI.
> Maybe a better word would be "configured", e.g. with 'setopt'
> ('setopt' supports non-customizable plain variables as
> 'setq' does, unlike 'set-variable' that refuses to change them).

I see.  Thank you!






^ permalink raw reply	[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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.