I'm trying to set the default font for my Emacs based on a variable (so I can use a different font on a different machine):
(setq fontspec (concat ck-font-name "-" (number-to-string ck-font-size)))
(set-default-font fontspec)
(set-fontset-font "fontset-default" nil
(font-spec :size ck-font-size :name ck-font-name))
(add-to-list 'default-frame-alist '(font . fontspec))
This basically works but the last line throws a warning:
frame-notice-user-settings: Invalid font: fontspec
I know what the problem is (fontspec
seems to not be defined when the list gets evaluated), but I don't know how to fix this; my elisp-fu is not good enough.
Can somebody explain me or give me a pointer where I can read how to fix this?