Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to get comfortable with emacs. I installed emacs starter kit. Now I'm trying to customize fonts. In ~/.emacs.d/init.el I did (set-frame-font "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1"). It is working fine untill I do C-x 5 2. The new frame gets created with fonts, that were on the system before my customization. How do I override this behaviour to use only fonts I specify in init.el? Should I, probably, create ~/.emacs file for such settings (it's missing now)?

share|improve this question

1 Answer 1

up vote 11 down vote accepted

set-frame-font sets the font of the current frame. To set the default font for all frames, include the following line in your ~/.emacs.d/init.el, set the font parameter in default-frame-alist:

(add-to-list 'default-frame-alist
             '(font . "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1"))

~/.emacs is the traditional location for Emacs's configuration file. ~/.emacs.d/init.el is an alternate name with exactly the same role. Use either (but not both).

For X displays (i.e. on unix, or on non-unix systems using an X server), you can also set the font through X resources. On many systems, ~/.Xresources is read when you log in, and you can write there:

Emacs.font: -adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1
share|improve this answer
    
Wow, thanks a lot! –  folone Nov 13 '10 at 21:26
    
Congrats on the 10K. –  Dennis Williamson Nov 13 '10 at 22:58
    
Yay, finally a working answer for this. set-default-font ...? No, that would be too simple! –  Sam Watkins Oct 2 '12 at 4:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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