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

Ensure that face-background reads indirect values #179

Merged
merged 1 commit into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
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
Ensure that face-background reads indirect values
The old design would return an inappropriate nil value if the referenced
face did not have an explicit background attribute.  This can happen if
a theme uses ':inherit' instead of specifying the face attributes
directly.

By declaring a fallback value, we make sure that such indirection will
note return a nil value.

This is related to issue 178:
<#178>.
  • Loading branch information
protesilaos committed Feb 24, 2022
commit 1f57a76f19a267e743e322ab37917dcb46eff378
4 changes: 2 additions & 2 deletions centaur-tabs-elements.el
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
:type 'int)

(defcustom centaur-tabs-background-color
(or (face-background 'centaur-tabs-default) (face-background 'default))
(face-background 'centaur-tabs-default nil 'default)
"*Background color of the tab bar.
By default, use the background color specified for the
`centaur-tabs-default' face (or inherited from another face), or the
Expand Down Expand Up @@ -193,7 +193,7 @@ If icon gray out option enabled, gray out icon if not SELECTED."
major-mode
:v-adjust centaur-tabs-icon-v-adjust
:height centaur-tabs-icon-scale-factor)))
(background (face-background face))
(background (face-background face nil 'default))
(inactive (cond ((and (not selected)
(eq centaur-tabs-gray-out-icons 'buffer))
(face-foreground 'mode-line-inactive))
Expand Down
2 changes: 1 addition & 1 deletion centaur-tabs-functions.el
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ tab(B), move A to the left of B" t)

(defun centaur-tabs-headline-match ()
"Make headline use centaur-tabs-default-face."
(set-face-attribute centaur-tabs-display-line nil :background (face-background 'centaur-tabs-unselected)
(set-face-attribute centaur-tabs-display-line nil :background (face-background 'centaur-tabs-unselected nil 'default)
:box nil
:overline nil
:underline nil))
Expand Down
8 changes: 4 additions & 4 deletions centaur-tabs.el
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ Run as `centaur-tabs-init-hook'."
;; If set, initialize selected overline
(when (eq centaur-tabs-set-bar 'under)
(set-face-attribute 'centaur-tabs-selected nil
:underline (face-background 'centaur-tabs-active-bar-face)
:underline (face-background 'centaur-tabs-active-bar-face nil 'default)
:overline nil)
(set-face-attribute 'centaur-tabs-selected-modified nil
:underline (face-background 'centaur-tabs-active-bar-face)
:underline (face-background 'centaur-tabs-active-bar-face nil 'default)
:overline nil)
(set-face-attribute 'centaur-tabs-unselected nil
:underline nil
Expand All @@ -177,10 +177,10 @@ Run as `centaur-tabs-init-hook'."
:overline nil))
(when (eq centaur-tabs-set-bar 'over)
(set-face-attribute 'centaur-tabs-selected nil
:overline (face-background 'centaur-tabs-active-bar-face)
:overline (face-background 'centaur-tabs-active-bar-face nil 'default)
:underline nil)
(set-face-attribute 'centaur-tabs-selected-modified nil
:overline (face-background 'centaur-tabs-active-bar-face)
:overline (face-background 'centaur-tabs-active-bar-face nil 'default)
:underline nil)
(set-face-attribute 'centaur-tabs-unselected nil
:overline nil
Expand Down