all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 71883@debbugs.gnu.org
Cc: adam@alphapapa.net, shipmints@gmail.com, joseph@breatheoutbreathe.in
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	[thread overview]
Message-ID: <861q4ce1yb.fsf@mail.linkov.net> (raw)
In-Reply-To: <87le2kaloz.fsf@breatheoutbreathe.in> (Joseph Turner via's message of "Mon, 01 Jul 2024 13:42:20 -0700")

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





  reply	other threads:[~2024-07-02  6:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=861q4ce1yb.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=71883@debbugs.gnu.org \
    --cc=adam@alphapapa.net \
    --cc=joseph@breatheoutbreathe.in \
    --cc=shipmints@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.