1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1987,93,94,95,1997,2001 Free Software Foundation, Inc.
3 @c See file emacs.texi for copying conditions.
4 @node X Resources, Antinews, Command Arguments, Top
5 @appendix X Options and Resources
7 You can customize some X-related aspects of Emacs behavior using X
8 resources, as is usual for programs that use X. On MS-Windows, you
9 can customize some of the same aspects using the system registry.
10 @xref{MS-Windows Registry}. X resources are the only way to customize
11 tooltip windows and LessTif menus, since the libraries that implement
12 them don't provide for customization through Emacs. This appendix
13 describes the X resources that Emacs recognizes and how to use them.
16 * Resources:: Using X resources with Emacs (in general).
17 * Table of Resources:: Table of specific X resources that affect Emacs.
18 * Face Resources:: X resources for customizing faces.
19 * Lucid Resources:: X resources for Lucid menus.
20 * LessTif Resources:: X resources for LessTif and Motif menus.
24 @appendixsec X Resources
27 @cindex X resources, @file{~/.Xdefaults} file
28 @cindex X resources, @file{~/.Xresources} file
29 Programs running under the X Window System organize their user
30 options under a hierarchy of classes and resources. You can specify
31 default values for these options in your X resources file, usually
32 named @file{~/.Xdefaults} or @file{~/.Xresources}.
33 If changes in @file{~/.Xdefaults} do not
34 take effect, it is because your X server stores its own list of
35 resources; to update them, use the shell command @command{xrdb}---for
36 instance, @samp{xrdb ~/.Xdefaults}.
38 Each line in the file specifies a value for one option or for a
39 collection of related options, for one program or for several programs
40 (optionally even for all programs).
42 @cindex Registry (MS-Windows)
43 @cindex @file{.Xdefaults} file, and MS-Windows
44 MS-Windows systems don't support @file{~/.Xdefaults} files, but
45 Emacs compiled for Windows looks for X resources in the Windows
46 Registry, under the key @samp{HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs}
47 and then under the key @samp{HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs}.
49 Programs define named resources with particular meanings. They also
50 define how to group resources into named classes. For instance, in
51 Emacs, the @samp{internalBorder} resource controls the width of the
52 internal border, and the @samp{borderWidth} resource controls the width
53 of the external border. Both of these resources are part of the
54 @samp{BorderWidth} class. Case distinctions are significant in these
57 In @file{~/.Xdefaults}, you can specify a value for a single resource
58 on one line, like this:
65 Or you can use a class name to specify the same value for all resources
66 in that class. Here's an example:
72 If you specify a value for a class, it becomes the default for all
73 resources in that class. You can specify values for individual
74 resources as well; these override the class value, for those particular
75 resources. Thus, this example specifies 2 as the default width for all
76 borders, but overrides this value with 4 for the external border:
83 The order in which the lines appear in the file does not matter.
84 Also, command-line options always override the X resources file.
86 The string @samp{emacs} in the examples above is also a resource
87 name. It actually represents the name of the executable file that you
88 invoke to run Emacs. If Emacs is installed under a different name, it
89 looks for resources under that name instead of @samp{emacs}.
92 @item -name @var{name}
94 @itemx --name=@var{name}
95 @cindex resource name, command-line argument
96 Use @var{name} as the resource name (and the title) for the initial
97 Emacs frame. This option does not affect subsequent frames, but Lisp
98 programs can specify frame names when they create frames.
100 If you don't specify this option, the default is to use the Emacs
101 executable's name as the resource name.
103 @item -xrm @var{resource-values}
105 @itemx --xrm=@var{resource-values}
106 @cindex resource values, command-line argument
107 Specify X resource values for this Emacs job (see below).
110 For consistency, @samp{-name} also specifies the name to use for
111 other resource values that do not belong to any particular frame.
113 The resources that name Emacs invocations also belong to a class; its
114 name is @samp{Emacs}. If you write @samp{Emacs} instead of
115 @samp{emacs}, the resource applies to all frames in all Emacs jobs,
116 regardless of frame titles and regardless of the name of the executable
117 file. Here is an example:
124 You can specify a string of additional resource values for Emacs to
125 use with the command line option @samp{-xrm @var{resources}}. The text
126 @var{resources} should have the same format that you would use inside a file
127 of X resources. To include multiple resource specifications in
128 @var{resources}, put a newline between them, just as you would in a file.
129 You can also use @samp{#include "@var{filename}"} to include a file full
130 of resource specifications. Resource values specified with @samp{-xrm}
131 take precedence over all other resource specifications.
133 One way to experiment with the effect of different resource settings
134 is to use the @code{editres} program. Select @samp{Get Tree} from the
135 @samp{Commands} menu, then click on an Emacs frame. This will display
136 a tree showing the structure of X toolkit widgets used in an Emacs
137 frame. Select one of them, such as @samp{menubar}, then select
138 @samp{Show Resource Box} from the @samp{Commands} menu. This displays
139 a list of all the meaningful X resources and allows you to edit them.
140 Changes take effect immediately if you click on the @samp{Apply} button.
142 @node Table of Resources
143 @appendixsec Table of X Resources for Emacs
145 This table lists the resource names that designate options for
146 Emacs, not counting those for the appearance of the menu bar, each
147 with the class that it belongs to:
150 @item @code{background} (class @code{Background})
151 Background color name.
153 @item @code{bitmapIcon} (class @code{BitmapIcon})
154 Use a bitmap icon (a picture of a gnu) if @samp{on}, let the window
155 manager choose an icon if @samp{off}.
157 @item @code{borderColor} (class @code{BorderColor})
158 Color name for the external border.
160 @item @code{borderWidth} (class @code{BorderWidth})
161 Width in pixels of the external border.
163 @item @code{cursorColor} (class @code{Foreground})
164 Color name for text cursor (point).
166 @item @code{font} (class @code{Font})
167 Font name for text (or fontset name, @pxref{Fontsets}).
169 @item @code{foreground} (class @code{Foreground})
172 @item @code{geometry} (class @code{Geometry})
173 Window size and position. Be careful not to specify this resource as
174 @samp{emacs*geometry}, because that may affect individual menus as well
175 as the Emacs frame itself.
177 If this resource specifies a position, that position applies only to the
178 initial Emacs frame (or, in the case of a resource for a specific frame
179 name, only that frame). However, the size, if specified here, applies to
182 @item @code{fullscreen} (class @code{Fullscreen})
183 The desired fullscreen size. The value can be one of @code{fullboth},
184 @code{fullwidth} or @code{fullheight}, which correspond to
185 the command-line options @samp{-fs}, @samp{-fw}, and @samp{-fh}
186 (@pxref{Window Size X}).
188 Note that this applies to all frames created, not just the initial
191 @item @code{iconName} (class @code{Title})
192 Name to display in the icon.
194 @item @code{internalBorder} (class @code{BorderWidth})
195 Width in pixels of the internal border.
197 @item @code{lineSpacing} (class @code{LineSpacing})
200 Additional space (@dfn{leading}) between lines, in pixels.
202 @item @code{menuBar} (class @code{MenuBar})
203 Give frames menu bars if @samp{on}; don't have menu bars if
204 @samp{off}. @xref{Lucid Resources}, and @ref{LessTif Resources}, for
205 how to control the appearance of the menu bar if you have one.
207 @item @code{toolBar} (class @code{ToolBar})
208 Number of lines to reserve for the tool bar. A zero value suppresses
209 the tool bar. If the value is non-zero and
210 @code{auto-resize-tool-bars} is non-@code{nil}, the tool bar's size
211 will be changed automatically so that all tool bar items are visible.
213 @item @code{minibuffer} (class @code{Minibuffer})
214 If @samp{none}, don't make a minibuffer in this frame.
215 It will use a separate minibuffer frame instead.
217 @item @code{paneFont} (class @code{Font})
218 @cindex font for menus
219 Font name for menu pane titles, in non-toolkit versions of Emacs.
221 @item @code{pointerColor} (class @code{Foreground})
222 Color of the mouse cursor.
224 @item @code{privateColormap} (class @code{PrivateColormap})
225 If @samp{on}, use a private color map, in the case where the ``default
226 visual'' of class PseudoColor and Emacs is using it.
228 @item @code{reverseVideo} (class @code{ReverseVideo})
229 Switch foreground and background default colors if @samp{on}, use colors as
230 specified if @samp{off}.
232 @item @code{screenGamma} (class @code{ScreenGamma})
233 @cindex gamma correction
234 Gamma correction for colors, equivalent to the frame parameter
237 @item @code{selectionFont} (class @code{SelectionFont})
238 Font name for pop-up menu items, in non-toolkit versions of Emacs. (For
239 toolkit versions, see @ref{Lucid Resources}, also see @ref{LessTif
242 @item @code{selectionTimeout} (class @code{SelectionTimeout})
243 Number of milliseconds to wait for a selection reply.
244 If the selection owner doesn't reply in this time, we give up.
245 A value of 0 means wait as long as necessary.
247 @item @code{synchronous} (class @code{Synchronous})
248 @cindex debugging X problems
249 @cindex synchronous X mode
250 Run Emacs in synchronous mode if @samp{on}. Synchronous mode is
251 useful for debugging X problems.
253 @item @code{title} (class @code{Title})
254 Name to display in the title bar of the initial Emacs frame.
256 @item @code{verticalScrollBars} (class @code{ScrollBars})
257 Give frames scroll bars if @samp{on}; don't have scroll bars if
262 @appendixsec X Resources for Faces
264 You can also use resources to customize the appearance of particular
265 faces (@pxref{Faces}):
268 @item @var{face}.attributeFont
269 Font for face @var{face}.
270 @item @var{face}.attributeForeground
271 Foreground color for face @var{face}.
272 @item @var{face}.attributeBackground
273 Background color for face @var{face}.
274 @item @var{face}.attributeUnderline
275 Underline flag for face @var{face}. Use @samp{on} or @samp{true} for
277 @item @var{face}.attributeFamily
278 Font family for face @var{face}.
279 @item @var{face}.attributeWidth
280 Relative proportional width of the font to use for face @var{face}.
281 It should be one of @code{ultra-condensed}, @code{extra-condensed},
282 @code{condensed}, @code{semi-condensed}, @code{normal},
283 @code{semi-expanded}, @code{expanded}, @code{extra-expanded}, or
284 @code{ultra-expanded}.
285 @item @var{face}.attributeHeight
286 Height of the font to use for face @var{face}: either an integer
287 specifying the height in units of 1/10@dmn{pt}, or a floating point
288 number that specifies a scale factor to scale the underlying face's
289 default font, or a function to be called with the default height which
290 will return a new height.
291 @item @var{face}.attributeWeight
292 A weight to use for the face @var{face}. It must be one of
293 @code{ultra-bold}, @code{extra-bold}, @code{bold},
294 @code{semi-bold}, @code{normal}, @code{semi-light}, @code{light},
295 @code{extra-light}, @code{ultra-light}.
296 @item @var{face}.attributeSlant
297 The slant to use for the font of face @var{face}. It must be one of
298 @code{italic}, @code{oblique}, @code{normal},
299 @code{reverse-italic}, or @code{reverse-oblique}.
300 @item @var{face}.attributeStrikeThrough
301 Whether the face @var{face} should be drawn with a line striking
302 through the characters.
303 @item @var{face}.attributeOverline
304 Whether the characters in the face @var{face} should be overlined.
305 @item @var{face}.attributeBox
306 Whether to draw a box around the characters in face @var{face}.
307 @item @var{face}.attributeInverse
308 Whether to display the characters in face @var{face} in inverse
310 @item @var{face}.attributeStipple
311 The name of a pixmap data file to use for the stipple pattern, or
312 @code{false} to not use stipple for the face @var{face}.
313 @item @var{face}.attributeBackgroundPixmap
314 The background pixmap for the face @var{face}. Should be a name of a
315 pixmap file or @code{false}.
316 @item @var{face}.attributeBold
317 Whether to draw the characters in the face @var{face} as bold.
318 @item @var{face}.attributeItalic
319 Whether to draw the characters in the face @var{face} as italic.
322 @node Lucid Resources
323 @appendixsec Lucid Menu X Resources
324 @cindex Menu X Resources (Lucid widgets)
325 @cindex Lucid Widget X Resources
327 If the Emacs installed at your site was built to use the X toolkit
328 with the Lucid menu widgets, then the menu bar is a separate widget and
329 has its own resources. The resource names contain @samp{pane.menubar}
330 (following, as always, the name of the Emacs invocation, or @samp{Emacs},
331 which stands for all Emacs invocations). Specify them like this:
334 Emacs.pane.menubar.@var{resource}: @var{value}
338 For example, to specify the font @samp{8x16} for the menu-bar items,
342 Emacs.pane.menubar.font: 8x16
346 Resources for @emph{non-menubar} toolkit pop-up menus have
347 @samp{menu*}, in like fashion. For example, to specify the font
348 @samp{8x16} for the pop-up menu items, write this:
351 Emacs.menu*.font: 8x16
355 For dialog boxes, use @samp{dialog} instead of @samp{menu}:
358 Emacs.dialog*.font: 8x16
362 Experience shows that on some systems you may need to add
363 @samp{shell.}@: before the @samp{pane.menubar} or @samp{menu*}. On
364 some other systems, you must not add @samp{shell.}.
366 Here is a list of the specific resources for menu bars and pop-up menus:
370 Font for menu item text.
372 Color of the foreground.
374 Color of the background.
375 @item buttonForeground
376 In the menu bar, the color of the foreground for a selected item.
377 @item horizontalSpacing
378 Horizontal spacing in pixels between items. Default is 3.
379 @item verticalSpacing
380 Vertical spacing in pixels between items. Default is 1.
382 Horizontal spacing between the arrow (which indicates a submenu) and
383 the associated text. Default is 10.
384 @item shadowThickness
385 Thickness of shadow line around the widget.
387 The margin of the menu bar, in characters. The default of 4 makes the
388 menu bar appear like the LessTif/Motif one.
391 @node LessTif Resources
392 @appendixsec LessTif Menu X Resources
393 @cindex Menu X Resources (LessTif widgets)
394 @cindex LessTif Widget X Resources
396 If the Emacs installed at your site was built to use the X toolkit
397 with the LessTif or Motif widgets, then the menu bar, the dialog
398 boxes, the pop-up menus, and the file-selection box are separate
399 widgets and have their own resources.
401 The resource names for the menu bar contain @samp{pane.menubar}
402 (following, as always, the name of the Emacs invocation, or
403 @samp{Emacs}, which stands for all Emacs invocations). Specify them
407 Emacs.pane.menubar.@var{subwidget}.@var{resource}: @var{value}
410 Each individual string in the menu bar is a subwidget; the subwidget's
411 name is the same as the menu item string. For example, the word
412 @samp{File} in the menu bar is part of a subwidget named
413 @samp{emacs.pane.menubar.File}. Most likely, you want to specify the
414 same resources for the whole menu bar. To do this, use @samp{*} instead
415 of a specific subwidget name. For example, to specify the font
416 @samp{8x16} for the menu-bar items, write this:
419 Emacs.pane.menubar.*.fontList: 8x16
423 This also specifies the resource value for submenus.
425 Each item in a submenu in the menu bar also has its own name for X
426 resources; for example, the @samp{File} submenu has an item named
427 @samp{Save (current buffer)}. A resource specification for a submenu
428 item looks like this:
431 Emacs.pane.menubar.popup_*.@var{menu}.@var{item}.@var{resource}: @var{value}
435 For example, here's how to specify the font for the @samp{Save (current
439 Emacs.pane.menubar.popup_*.File.Save (current buffer).fontList: 8x16
443 For an item in a second-level submenu, such as @samp{Complete Word}
444 under @samp{Spell Checking} under @samp{Tools}, the resource fits this
448 Emacs.pane.menubar.popup_*.popup_*.@var{menu}.@var{resource}: @var{value}
455 Emacs.pane.menubar.popup_*.popup_*.Spell Checking.Complete Word: @var{value}
459 (This should be one long line.)
461 It's impossible to specify a resource for all the menu-bar items
462 without also specifying it for the submenus as well. So if you want the
463 submenu items to look different from the menu bar itself, you must ask
464 for that in two steps. First, specify the resource for all of them;
465 then, override the value for submenus alone. Here is an example:
468 Emacs.pane.menubar.*.fontList: 8x16
469 Emacs.pane.menubar.popup_*.fontList: 8x16
473 For LessTif pop-up menus, use @samp{menu*} instead of
474 @samp{pane.menubar}. For example, to specify the font @samp{8x16} for
475 the pop-up menu items, write this:
478 Emacs.menu*.fontList: 8x16
482 For LessTif dialog boxes, use @samp{dialog} instead of @samp{menu}:
485 Emacs.dialog*.fontList: 8x16
486 Emacs.dialog*.foreground: hotpink
489 To specify resources for the LessTif file-selection box, use
490 @samp{fsb*}, like this:
493 Emacs.fsb*.fontList: 8x16
499 Here is a list of the specific resources for LessTif menu bars and
504 The color to show in an armed button.
513 Amount of space to leave around the item, within the border.
515 The width of the border around the menu item, on all sides.
516 @item shadowThickness
517 The width of the border shadow.
518 @item bottomShadowColor
519 The color for the border shadow, on the bottom and the right.
521 The color for the border shadow, on the top and the left.