Skip to content

[PATCH] Ensure default background color is not nil #178

Closed
@protesilaos

Description

I just noticed a bug in centaur-tabs-background-color. It would take an inappropriate nil value under certain circumstances.

I have produced this patch, but I can try a pull request if you prefer that. Thank you!

From a18b33cad06d3fe7f570844dfb73fc09105c20d3 Mon Sep 17 00:00:00 2001
Message-Id: <a18b33cad06d3fe7f570844dfb73fc09105c20d3.1645609926.git.info@protesilaos.com>
From: Protesilaos Stavrou <info@protesilaos.com>
Date: Wed, 23 Feb 2022 11:51:59 +0200
Subject: [PATCH] Ensure default background color is not nil

The previous value would return nil if the 'centaur-tabs-default' did
not have an explicit background attribute (e.g. it does not have one if
it inherits from another face).

The 'or' ensures that we fall back to the background of the 'default'
face, which always has all its attributes specified.
---
 centaur-tabs-elements.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/centaur-tabs-elements.el b/centaur-tabs-elements.el
index 0bc435e..65158e3 100644
--- a/centaur-tabs-elements.el
+++ b/centaur-tabs-elements.el
@@ -120,7 +120,8 @@ (defcustom centaur-tabs-label-fixed-length 0
   :group 'centaur-tabs
   :type 'int)
 
-(defcustom centaur-tabs-background-color (face-background 'centaur-tabs-default)
+(defcustom centaur-tabs-background-color 
+  (or (face-background 'centaur-tabs-default) (face-background '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
-- 
2.35.1

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions