21.11 Frame Parameters
You can control the default appearance and behavior of all frames by
specifying a default list of frame parameters in the variable
default-frame-alist
. Its value should be a list of entries,
each specifying a parameter name and a value for that parameter.
These entries take effect whenever Emacs creates a new frame,
including the initial frame.
For example, you can add the following lines to your init file
(see The Emacs Initialization File) to set the default frame width to 90 character
columns, the default frame height to 40 character rows, and the
default font to ‘ Monospace-10
’:
(add-to-list 'default-frame-alist '(width . 90))
(add-to-list 'default-frame-alist '(height . 40))
(add-to-list 'default-frame-alist '(font . "Monospace-10"))
For a list of frame parameters and their effects, see Frame
Parameters in The Emacs Lisp Reference Manual.
You can also specify a list of frame parameters which apply to just
the initial frame, by customizing the variable
initial-frame-alist
.
If Emacs is compiled to use an X toolkit, frame parameters that specify colors and fonts don’t affect menus and the menu bar, since those are drawn by the toolkit and not directly by Emacs.
Frame appearance and behavior can also be customized through X resources (see X Options and Resources); these override the parameters of the initial frame specified in your init file.
Note that if you are using the desktop library to save and restore
your sessions, the frames to be restored are recorded in the desktop
file, together with their parameters. When these frames are restored,
the recorded parameters take precedence over the frame parameters
specified by default-frame-alist
and initial-frame-alist
in your init file. See Saving Emacs Sessions, for how to avoid
that.