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?

myTerminal
  • 417
  • 1
  • 5
  • 15
  • 3
    Possible duplicate of [How to evaluate the variables before adding them to a list?](https://emacs.stackexchange.com/questions/7481/how-to-evaluate-the-variables-before-adding-them-to-a-list) – Drew Mar 16 '18 at 17:45

1 Answers1

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)))))
matteol
  • 1,868
  • 1
  • 9
  • 11