1

I am trying to just adjust a few colors, without creating a whole theme. My lisp startup file contains:

(load-theme 'tsdh-dark t nil)
...
(set-face-foreground 'custom-variable-tag "White")

For some reason, the face 'custom-variable-tag is not recognized during Emacs startup; but when I eval this Lisp code during an Emacs session, it works fine and changes the color as expected.

What could be the issue?

1 Answer 1

1

Do M-x describe-face RET custom-variable-tag to find out where the face is defined. It turns out to be defined in cus-edit. Presumably somebody loads cus-edit eventually, so that later on in the Emacs session it is defined and you can modify it. But it is probably not loaded early enough so that you can do the modification in your init file.

You can force it to be loaded:

(load-theme 'tsdh-dark t nil)
(require 'cus-edit)
...
(set-face-foreground 'custom-variable-tag "White")

or you can arrange for the modification to be done after it is loaded:

(load-theme 'tsdh-dark t nil)
...
(eval-after-load 'cus-edit 
    (set-face-foreground 'custom-variable-tag "White"))

In general, things need to be defined before they are used: that applies to variables, functions and faces and the solution is always the same as above: either load the library that defines the object before you modify it, or arrange for the modification to happen after the defining library has been loaded.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.