Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to display tabs correctly with tab-bar-format-tabs-groups under tab-bar-mode #107

Open
shipmints opened this issue Jun 22, 2024 · 7 comments
Assignees
Labels
bug Something isn't working compatibility
Milestone

Comments

@shipmints
Copy link

activities needs to respect tab-bar-mode's tab-bar-tab-group-face-function override in the same way it currently respects tab-bar-tab-face-function. The lack of support means that the activities-tab face is never applied.

A PR coming shortly with the tested fix for this.

Configuration snippet for testing:

  (setq tab-bar-format
        '(
          tab-bar-format-tabs-groups ;; this shows groups
          ;; tab-bar-format-tabs ;; switch to this for plain tabs
          tab-bar-separator
          activate
          tab-bar-format-align-right
          tab-bar-format-global
          ))

With groups enabled, you'll have to assign a group to one tab to get the group to appear and for the broken formatting path to be invoked.

You can invoke this to ensure there's at least one group for testing (tab-bar-change-tab-group "*default*")

or call M-x tab-group to assign a name interactively.

P.S. While reading through the tab-bar-mode code, it appears there is a bug that, if fixed, might render the PR correction unneeded. Perhaps in Emacs 30 if this is truly a bug and gets reported.

(defun tab-bar-tab-group-face-default (tab)
  (if (not (or (eq (car tab) 'current-tab)
               (funcall tab-bar-tab-group-function tab)))
      'tab-bar-tab-ungrouped
    (tab-bar-tab-face-default tab)))

At the end of the function, tab-bar-tab-face-default is called and not tab-bar-tab-face-function so the override is never applied when groups are being formatted. Since the override would have been set to activities-tabs--tab-bar-tab-face-function the custom face is never applied. Also, to get around this, one can't mix both the tab format and the group format or the tabs get repeated.

@shipmints
Copy link
Author

See #108.

@alphapapa
Copy link
Owner

P.S. While reading through the tab-bar-mode code, it appears there is a bug that, if fixed, might render the PR correction unneeded. Perhaps in Emacs 30 if this is truly a bug and gets reported.

Would you please report that bug, then? If it is truly a bug (you should probably cc Juri on it, as he's the maintainer of that library), then it might not be too late to get it fixed in Emacs 30. Then, if it's as you say, we might be able to omit the change here.

@alphapapa alphapapa added bug Something isn't working question Further information is requested compatibility labels Jun 23, 2024
@alphapapa alphapapa added this to the Future milestone Jun 23, 2024
@shipmints
Copy link
Author

@shipmints
Copy link
Author

Looks like we need this small change afterall. I did not check Juri's contention. It's his code.


From: | Juri Linkov
Subject: | bug#71733: 29.3; tab-bar-tab-group-face-default invokes tab-bar-tab-face-default incorrectly?
Date: | Sun, 23 Jun 2024 20:30:48 +0300

tags 71733 wontfix
close 71733 30.0.50
thanks

tab-bar-tab-group-face-default' hard codes the invocation to tab-bar-tab-face-default' but should it instead invoke
`tab-bar-tab-face-function' to benefit from a custom function?

(defun tab-bar-tab-group-face-default (tab)
(if (not (or (eq (car tab) 'current-tab)
(funcall tab-bar-tab-group-function tab)))
'tab-bar-tab-ungrouped
(tab-bar-tab-face-default tab)))
;; should the last line be something like this?
(funcall tab-bar-tab-face-function tab)))

I checked the latest `tab-bar' source code this morning and this hasn't yet
been addressed, if indeed this is unintended behavior.

Sorry, this can't be changed because it will cause an infinite recursion.
You can see in 'tab-bar-format-tabs-groups':

               (let ((tab-bar-tab-face-function
                      tab-bar-tab-group-face-function))
                 (tab-bar--format-tab tab i))

Then with the default value 'tab-bar-tab-group-face-default'
of 'tab-bar-tab-group-face-function', 'tab-bar-tab-face-function'
in 'tab-bar-tab-group-face-default' will recursively call itself.

@alphapapa
Copy link
Owner

Ok, thanks for checking on that.

@alphapapa alphapapa self-assigned this Jun 23, 2024
@alphapapa alphapapa modified the milestones: Future, 0.8 Jun 23, 2024
@alphapapa alphapapa removed the question Further information is requested label Jun 23, 2024
@shipmints
Copy link
Author

Juri said in a later email to me that he will improve the documentation. Our approach is the right one.

@shipmints
Copy link
Author

Fast. emacs-mirror/emacs@4a09586

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compatibility
Projects
None yet
Development

No branches or pull requests

2 participants