1

I'm following the instruction here to set the default font:

(add-to-list 'default-frame-alist '(font . "Monospace 10"))
(set-face-attribute 'default t :font "Monospace 10")

This works. To avoid the repetition, I tried factoring the string out with let:

(let ((f "Monospace 10"))
  (add-to-list 'default-frame-alist '(font . f))
  (set-face-attribute 'default t :font f))

The result I get when I load this is

Invalid font: f

Why is the second expression not equivalent to the first pair of statements?

Chris Martin
  • 121
  • 4
  • For reference about my background: I'm familiar with clojure, but obviously very new to elisp. – Chris Martin Feb 17 '16 at 01:49
  • @npostavs Hm, I don't understand the connection between this question and that one. :( – Chris Martin Feb 17 '16 at 01:56
  • 2
    The ' is blocking evaluation of f, as explained in the answers on the linked question. '(font . f) == (cons 'font 'f), but you want (cons 'font f) == \(font . ,f)` – npostavs Feb 17 '16 at 02:07

0 Answers0