1

I'm using bbatsov's prelude and I'm trying to change default font for when I'm running a GUI emacsclient window.

I've added the following to my ~/.emacs.d/personal/preludes:

(set-default-font "Source Code Pro-12")

And I see the font change if I just start emacs.

However, if I restart the emacs --daemon I have in the background and ask a GUI window to be opened using emacsclient -c, I don't see the default font changed to the one I want.

I've also tried to put that lisp code in a file in ~/.emacs.d/personal/preload/preludes.el but it made no difference.

Any ideas?

Cheers

1 Answer 1

5

I found the answer here. Instead of set-default-font, I needed the following:

(setq default-frame-alist '((font . "Source Code Pro-12")))
4
  • 1
    I use emacsclient too and the best way to control fonts is via ~/.Xresources. Commented Feb 18, 2016 at 17:37
  • 1
    @KaushalModi: (1) Define "best" (i.e., why?). (2) ~/.Xresources works only on some platforms.
    – Drew
    Commented Feb 19, 2016 at 2:49
  • 1
    @Drew I have jumped through hoops to get the initial font config and frame size right and ~/.Xresources turned out to be the golden solution, especially with emacsclient. I have noticed that if the font/frame config is in init.el, emacs will start up with the default font/frame config and then readjust based on the config in the init.el. I agree with your second point though. I should have asked which OS the OP is using. I customize my ~/.Xresources on Linux (RHEL 6.6). Commented Feb 19, 2016 at 3:17
  • 1
    FYI, in my case I'm on OSX Commented Feb 19, 2016 at 8:06

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.