views:

644

answers:

3

I want to know, what text do I have to input in the .emacs file so that it uses a especific font (like the clean 5x8) on the new frames, such as with the speedbar. I can modify the speedbar font size and type by using SHIFT-LeftClick but I want it to stay by default.

+3  A: 

There are several choices. Perhaps the easiest is to use Customize to change the default frame font. Choose Customize from the menu, use a regex to find default-frame-alist.

Set the Font property (You may have to add it to the list.) Mine is set as

"-*-*-medium-r-normal--16-*-*-*-*-*-fontset-osaka"

Second choice is to actually set the default-frame-alist in your .emacs.

Here's a hint: set up your current frame the way you like it, then type

(pp (current-frame-configuration))^J

in the *scratch* buffer to find out all the frame parameters.

Charlie Martin
A: 

If you work in non-Debian linux, another way to set up a default font for emacs is to add emacs customisation to the file ~/.Xdefaults (in Debian, any file in /etc/X11/Xresources/ is used; for example, /etc/X11/Xresources/emacs):

emacs*font: 7x14

which may be followed by different other options:

emacs*Background: DarkSlateGray
emacs*Foreground: Wheat
emacs*pointerColor: Orchid
emacs*cursorColor: Orchid
emacs*bitmapIcon: on
emacs.geometry: 100x40

The name of the font above is not explicit, in some situations you may need to specify it explicitly, such as

emacs.font -*-*-medium-r-normal--14-130-75-75-c-70-fontset-startup

The exact name of your preferred font can obtain, as in the above answer, by typing

(pp (current-frame-configuration))^J

in the *scratch* buffer. You would need to reload X.

volodyako
No need to reload X. Make changes to `~/.Xdefaults`, as suggested above. Close emacs. Run the command: `xrdb -merge ~/.Xdefaults`. Restart emacs.
Prakash K
A: 
(eval-after-load 'speedbar
  (add-to-list 'speedbar-frame-parameters '(font . "5x8")))

or

M-x customize-variable
speedbar-frame-parameters
huaiyuan
Here is GNU Emacs 22.3.1. There is no variable `speedbar-frame-alist`
volodyako
Sorry, should be <code>'speedbar-frame-parameters</code>. I am running Emacs-23 pretest; not sure if it's in Emacs-22.3.
huaiyuan