2009-08-25

setting default font for emacs

On Aug 25, 7:11 pm, Tom Roche wrote:
> summary:
>
> I'm running an emacs-23 and am wanting to set my default font for
> every frame in init.el. How to do so properly?
> ...

yeah, there's a better way.

pull the menu “Options‣Set Default Font”. Choose a font. Then pull “Options‣Save Options”. That should do it. However, on Windows, i noticed there's a bug that doesn't save the font. A work around is that, once you did the above, then type M-x customize. Then randomly choose something to customize. Then press Save for Future Sessions. That should save the font you've choosen. In particular, you should add something like the following in your emacs init file:

(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:inherit nil :stipple nil :background "honeydew" :foreground "SystemWindowText" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "outline" :family "Lucida Sans Unicode"))))
'(completions-common-part ((t (:inherit default :foreground "red"))))
'(pp^L-highlight ((((type x w32 mac graphic) (class color)) (:underline "maroon"))))
'(show-paren-match ((((class color) (background light)) (:background "azure2")))))

I am also interested in the raw elisp code to save the font or other face related things, without the custom-set-faces.

Given a (custome-set-faces ...) code, how do i pull things out and create the equivalent elisp code? setq certainly won't work.

Xah
∑ http://xahlee.org/

No comments:

Post a Comment