1

I have some elisp code in my ~/.emacs which sets a variable for the default font:

(let ((myfont "Ubuntu Mono-13"))
  (unless (member myfont (font-family-list))
    (setq myfont "DejaVu Sans Mono-13"))
  (add-to-list 'default-frame-list '(font . myfont))
  (set-face-attribute 'default nil :font myfont))

however I'm having a hard time constructing the string which is the last parameter of the call to (add-to-list) such that the variable 'myfont' is evaluated. Instead of:

'(font . myfont)

I would like to send:

'(font . "Ubuntu Mono-13")

or

'(font . "DejaVu Sans Mono-13")

I've tried various things with (car), (cdr), and (concat) to no avail.

nrvale0
  • 63
  • 3
  • 4
    Have a look at [How to evaluate the variables before adding them to a list?](http://emacs.stackexchange.com/questions/7481/how-to-evaluate-the-variables-before-adding-them-to-a-list). For your specific case, you want to use `\`(font . ,myfont)` in your config rather than `'(font . myfont)`. – Dan Jul 31 '15 at 19:24
  • 4
    or `(cons 'font myfont)` – Jordon Biondo Jul 31 '15 at 19:27

0 Answers0