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

Fixes for tab formatting when using tab-bar-format-tabs-groups in tab… #108

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions activities-tabs.el
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
"Records the original value of `tab-bar-tab-face-function'.
When `activities-tabs-mode' is enabled.")

(defvar activities-tabs-tab-bar-tab-group-face-function-original nil
"Records the original value of `tab-bar-tab-group-face-function'.
When `activities-tabs-mode' is enabled.")

(defvar activities-kill-buffers)

;;;; Customization
Expand Down Expand Up @@ -82,14 +86,20 @@ accordingly."
;; reevaluated when they are already active.
(unless activities-tabs-tab-bar-tab-face-function-original
(setf activities-tabs-tab-bar-tab-face-function-original tab-bar-tab-face-function
tab-bar-tab-face-function #'activities-tabs--tab-bar-tab-face-function)))
tab-bar-tab-face-function #'activities-tabs--tab-bar-tab-face-function))
(unless activities-tabs-tab-bar-tab-group-face-function-original
(setf activities-tabs-tab-bar-tab-group-face-function-original tab-bar-tab-group-face-function
tab-bar-tab-group-face-function #'activities-tabs--tab-bar-tab-group-face-function)))
(remove-hook 'window-configuration-change-hook #'activities-tabs--window-configuration-change)
(advice-remove #'activities-resume #'activities-tabs-before-resume)
(pcase-dolist (`(,symbol . ,function) override-map)
(advice-remove symbol function))
(when activities-tabs-tab-bar-tab-face-function-original
(setf tab-bar-tab-face-function activities-tabs-tab-bar-tab-face-function-original
activities-tabs-tab-bar-tab-face-function-original nil)))))
activities-tabs-tab-bar-tab-face-function-original nil))
(when activities-tabs-tab-bar-tab-group-face-function-original
(setf tab-bar-tab-group-face-function activities-tabs-tab-bar-tab-group-face-function-original
activities-tabs-tab-bar-tab-group-face-function-original nil)))))

;;;; Commands

Expand Down Expand Up @@ -203,6 +213,15 @@ inherited."
`(:inherit (activities-tabs ,face))
face)))

(defun activities-tabs--tab-bar-tab-group-face-function (tab)
"Return a face for TAB when group formatting is set in the tab-bar.
If grouped TAB represents an activity, face `activities-tabs' is added as
inherited."
(let ((face (funcall activities-tabs-tab-bar-tab-group-face-function-original tab)))
(if (activities-tabs--tab-parameter 'activity tab)
`(:inherit (activities-tabs ,face))
face)))

(defun activities-tabs-activity--set (activity)
"Set the current activity.
Sets the current tab's `activity' parameter to ACTIVITY."
Expand Down