activities.el
activities.el copied to clipboard
Activities tabs should resize according to `tab-bar-auto-width`
Activities tabs are not resized even when the tab-bar-auto-width option is non-nil.
;; Create a bunch of activities, see the tab bar wrap
(progn
(setopt tab-bar-auto-width t)
(activities-tabs-mode 1)
(dotimes (i 10)
(activities-new (format "test-long-name-%s" i))))
;; Clean up
(progn
(dotimes (i 10)
(let* ((name (format "test-long-name-%s" i))
(activity (map-elt activities-activities name)))
(ignore-errors
(when (activities-activity-active-p activity)
(activities-close activity)))
(setf activities-activities (map-delete activities-activities name)))))
Internally, the tab-bar-auto-width function determines that a tab should be resized if its face is one of tab-bar-auto-width-faces. However, activities-tabs--tab-bar-tab-face-function (say that even once fast... 😉) sets the activities tab face to (:inherit (activities-tabs ,face)), so the activities tabs are never resized.
A couple of quick notes from our discussion:
- Maybe we can use a zero-width space, i.e. only apply the activities face to everything after a zero-width space, leaving the face of the first character as
tab-bar-auto-widthexpects. - Beyond that, we might want to propose a patch for Emacs 30 to make this more flexible.
- Maybe we can use a zero-width space, i.e. only apply the activities face to everything after a zero-width space, leaving the face of the first character as
tab-bar-auto-widthexpects.
I think this solution is not currently possible since tab-bar-tab-face-function defines a face which is applied to the whole tab name string. I don't know of a way to apply different faces to parts of the string.
FYI, I use this styling with my modus-theme set up:
(set-face-attribute 'activities-tabs nil :inherit 'tab-bar-tab
:box '(:line-width (-1 . -1) :color "white" :style nil))
Which adds a nice white box around tabs that are registered as activities tabs. I'd prefer to keep that kind of styling so perhaps @josephmturner could try this out with the proposed change?
@shipmints Please consider upstreaming your face changes to https://github.com/protesilaos/modus-themes other modus-themes users can benefit too!
perhaps @josephmturner could try this out with the proposed change?
What proposed change?
I'm suggesting testing this proposed change https://github.com/alphapapa/activities.el/pull/79/files to the code base (as yet unmerged/unaccepted)
with this styling
(set-face-attribute 'activities-tabs nil :inherit 'tab-bar-tab
:box '(:line-width (-1 . -1) :color "white" :style nil))
That change comments out the reference to the 'activities-tabs face, so the set-face-attribute form you posted has no effect.
I'd prefer that it has an effect. Do you have an alternative recommendation for how one would otherwise face an activities controlled tab?
Like @alphapapa suggested
2. Beyond that, we might want to propose a patch for Emacs 30 to make this more flexible.
@shipmints @alphapapa please see the patch I just submitted as issue #71883.
@shipmints @alphapapa the patch was merged with additional backwards-compatibility changes added by Juri. When you get a chance, please see if auto-width tabs work as expected on the Emacs master branch. Closing now since this issue should now be fixed in Emacs.