2

The below line works correctly:

(custom-set-faces
 '(default ((t (:family "Liberation Mono")))))

but when I try to retrieve the font-face from a variable, it fails

(setq font-family-default
  "Liberation Mono")
(custom-set-faces
 '(default ((t (:family font-family-default)))))

Is there not a way to refer to a font-face through a variable/symbol?

1
3

When a list is prefixed with an apostrophe it is non evaluated (see quoting in the emacs manual), this means that custom-set-faces sees font-family-default instead of the value of the variable you defined. You have to use a backtick instead of the apostrophe and add a comma before the variable to evaluate it (see backquote in the emacs manual).

(setq font-family-default
      "Liberation Mono")
(custom-set-faces
 `(default ((t (:family ,font-family-default)))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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