I have set up my system to start up an emacs daemon automatically at system startup, to avoid the several seconds delay when I want to edit a file. The problem is, that setting up fonts does not work when there are no open frames. Moreover, in archlinux, emacs 24.5.1 actually crashes if I do that.
The surprising thing is that setting up fonts via either of the hooks
after-make-frame-functions
or before-make-frame-hook
does not work -
the former does not set them up the first time a frame is opened, and
the second one continues leading to a crash (as one might expect).
I recently stumbled upon this entry in emacswiki,
where someone uses server-create-window-system-frame
for a similar job
(setting up a theme only for frames in the window syste). Now I use the
following code to setup proper looking fonts in emacs, in all situations