1

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.

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
oscarcardoso
  • 168
  • 2
  • 10
  • Thanks a lot for all of you guys, each one of the answers helped me in some way. Having just used emacs for a couple of months, it's proving to be really helpfull. With the exception of code completion like in most IDEs, emacs has a lot of features that I could never figure out without swimming thru the web. Best regards and hope to continue to make a good use of SO! – oscarcardoso Jun 04 '09 at 12:20
  • Aha, another one turned to the One True Editor. Have a look at the EMACS Wiki for more fun (like code completion modes): http://www.emacswiki.org/ – Charlie Martin Jun 04 '09 at 14:17
  • Thnx :) I've been wandering thru the Wiki for a while, but it's quite a lot of info to catch in just a few sessions overseas while making a simple Pong clone in C++ with OpenGL and SDL. I still have to get the main terms right (even more difficult, being that my native language is not english). But...i think that i'll get the hang of it eventually :) – oscarcardoso Jun 04 '09 at 21:22

4 Answers4

3

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.

Svante
  • 50,694
  • 11
  • 78
  • 122
Charlie Martin
  • 110,348
  • 25
  • 193
  • 263
1

Customize option default-frame-alist. End of story.

For font changes, see this page: http://www.emacswiki.org/emacs/SetFonts.

Drew
  • 29,895
  • 7
  • 74
  • 104
0

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.

  • No need to reload X. Make changes to `~/.Xdefaults`, as suggested above. Close emacs. Run the command: `xrdb -merge ~/.Xdefaults`. Restart emacs. – Prakash K May 12 '10 at 00:43
0
(eval-after-load 'speedbar
  (add-to-list 'speedbar-frame-parameters '(font . "5x8")))

or

M-x customize-variable
speedbar-frame-parameters
huaiyuan
  • 26,129
  • 5
  • 57
  • 63
  • Here is GNU Emacs 22.3.1. There is no variable `speedbar-frame-alist` –  Jun 04 '09 at 13:18
  • Sorry, should be 'speedbar-frame-parameters. I am running Emacs-23 pretest; not sure if it's in Emacs-22.3. – huaiyuan Jun 04 '09 at 19:44