Customizing via Your .Xdefaults File

It’s also possible to customize your Emacs by setting X resources, in your .Xdefaults file (or, if you have one, your .Xresources file). We’ll cover a few of the more important resources here; for a full list of the resources you can set, see the GNU Emacs manpage.

To set one of these resources, first edit your resource file. For each resource you want to set, add a line like this:

emacs.<resource>:<value>

For example, to set a geometry resource, you might add

emacs.geometry:=80x49+270+0

With this line, the geometry resource gets the value =80x49+270+0. This tells Emacs to use a window 80 characters wide by 49 characters high, with the beginning at pixel (270, 0) on the screen. A 1024x768 screen with a 14-point font and no borders on the window makes the Emacs window neatly fill the right three-fourths of your screen, giving you as many vertical lines as will fit. You can modify this example in an obvious way to suit your setup. For full details on how to construct geometry resources, see the X manpage.

The font resource allows you to set the display font to be used by Emacs under X. Note that only fixed-width fonts will work. Here’s an example:

emacs.Font:*fixed-bold-r-*-14-*-*

This example sets a 14-point, 75-dot-per-inch (dpi) font that works nicely on a 17-inch, 0.31-pitch 1024x768 monitor. For tighter pitches or larger monitors, you may be able to use a smaller point size and fit more text lines in your Emacs window. If you have one of the high-end, ...

Get Learning GNU Emacs, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.