windowsemacsfonts

Setting emacs font under windows


I'm having trouble to change the font for my emacs configuration. I've tried using set-default-font, and managed to tab to my desired font, however, some elements are still rendered as the old font (ie python's class names and function names)


Solution

  • set-default-font is really old, and has been deprecated in Emacs 23 in favor of its new name set-frame-font (which isn't much better). The current Emacs manual suggests several ways to set the default font, but I'll assume you've found those already, seeing as you've tried set-default-font...

    The elisp code I use is actually different from all the methods suggested there:

    ;; [in .emacs]
    ;; Use 10-pt Consolas as default font
    (set-face-attribute 'default nil
                        :family "Consolas" :height 100)
    

    set-face-attribute seems to stick better than set-default-font; at least it seems to use Consolas consistently even in things like Python class and function names.