6

I had set up a emacs --daemon at the OS startup and whenever I try to open emacsclient -n -c emacs opens a small window (possibly the minimum size possible) and with unreadable fonts (they are too small). A following picture shows the emacs window in perspective when opened with emacsclient -n -c

Small emacs window with small fonts

However, if I try to open an emacs frame on the default OS terminal (emacsclient -t) it works perfectly:

Emacs frame on a terminal

Whats wrong with emacs? I use Prelude and I have a .Xdefaults file containing Emacs.font: Ubuntu-10 that specify which font to use, but that doesn't seem to work.

4
  • Is it any different from how Emacs looks when you run it graphically without a daemon?
    – user12563
    Commented Sep 28, 2017 at 21:44
  • Yes, totally normal
    – ranu
    Commented Sep 28, 2017 at 21:45
  • Can you reproduce this if you start Emacs with emacs --daemon -q? If not, post your init file. Commented Jan 12, 2018 at 20:38
  • @Gilles it can’t be reproduced with emacs --daemon -q. Something in my init file maybe? I’m using prelude fwiw, and the init file is entirely made of prelude code.
    – ranu
    Commented Jan 24, 2018 at 13:54

2 Answers 2

2

I had the same problem, and it was because I was setting the font in my init file using

(set-frame-font FONT nil t)

which is closely related to GaryO's answer. Using

(setq default-frame-alist '((font . FONT)))

Note: make sure that you replace FONT with you desired font name that is already installed on your system. solved it for me.

3
  • set-frame-font indeed only applies to existing frames (as documented in the docstring).
    – Stefan
    Commented Jun 5, 2019 at 19:14
  • This was exactly my problem; I had a set-frame-font declaration in my init.el which caused the problem after I moved to using emacs in daemon-mode.
    – User12345
    Commented Sep 3, 2020 at 11:32
  • Sorry for the delay, but this is the correct answer for me.
    – ranu
    Commented Dec 18, 2023 at 3:01
4

I've gotten this too. I think it's because when emacs is started in daemon mode, window-system is nil while reading your .emacs. You're probably setting up your default-frame-alist with something like (if window-system (...)) which won't work in daemon mode. Do it in a hook on after-make-frame-functions instead; that hook function takes the new frame as an arg.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.