In Emacs theme definition, why are there structures like (t (:background "black"))

104 views Asked by At

enter image description here

Why do the theme definitions contain structures like (t (:background "black"))? What is the role of t?

1

There are 1 answers

0
Andrzej Pronobis On

The sexp ((t (:foreground ... ))) is a face specification which is described here: http://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Faces.html

In short, it is an alist of the form (display . plist) and hence in your code t corresponds to display and (:background... ) is the plist. plist is the property list of face attributes, and I'm not going to talk about it since it's not relevant to the question. However, display can take other values than t. The aforementioned documentation describes display as:

The display part of an element of spec determines which terminals the element matches.

and the value t means:

This element of spec matches all terminals.

However, you could be more selective and define your face attributes to only apply to certain terminals, for instance only those that support color.