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. X resources are the
9 only way to customize tooltip windows and LessTif menus, since the
10 libraries that implement them don't provide for customization through
11 Emacs. This appendix describes the X resources that Emacs recognizes
15 * Resources:: Using X resources with Emacs (in general).
16 * Table of Resources:: Table of specific X resources that affect Emacs.
17 * Face Resources:: X resources for customizing faces.
18 * Lucid Resources:: X resources for Lucid menus.
19 * LessTif Resources:: X resources for LessTif and Motif menus.
23 @appendixsec X Resources
26 @cindex X resources, @file{~/.Xdefaults} file
27 Programs running under the X Window System organize their user
28 options under a hierarchy of classes and resources. You can specify
29 default values for these options in your X resources file, usually
30 named @file{~/.Xdefaults}. If changes in @file{~/.Xdefaults} do not
31 take effect, it is because your X server stores its own list of
32 resources; to update them, use the shell command @command{xrdb}---for
33 instance, @samp{xrdb ~/.Xdefaults}.
35 Each line in the file specifies a value for one option or for a
36 collection of related options, for one program or for several programs
37 (optionally even for all programs).
39 @cindex Registry (MS-Windows)
40 @cindex @file{.Xdefaults} file, and MS-Windows
41 MS-Windows systems don't support @file{~/.Xdefaults} files, but
42 Emacs compiled for Windows looks for X resources in the Windows
43 Registry, under the key @samp{HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs}
44 and then under the key @samp{HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs}.
46 Programs define named resources with particular meanings. They also
47 define how to group resources into named classes. For instance, in
48 Emacs, the @samp{internalBorder} resource controls the width of the
49 internal border, and the @samp{borderWidth} resource controls the width
50 of the external border. Both of these resources are part of the
51 @samp{BorderWidth} class. Case distinctions are significant in these
54 In @file{~/.Xdefaults}, you can specify a value for a single resource
55 on one line, like this:
62 Or you can use a class name to specify the same value for all resources
63 in that class. Here's an example:
69 If you specify a value for a class, it becomes the default for all
70 resources in that class. You can specify values for individual
71 resources as well; these override the class value, for those particular
72 resources. Thus, this example specifies 2 as the default width for all
73 borders, but overrides this value with 4 for the external border:
80 The order in which the lines appear in the file does not matter.
81 Also, command-line options always override the X resources file.
83 The string @samp{emacs} in the examples above is also a resource
84 name. It actually represents the name of the executable file that you
85 invoke to run Emacs. If Emacs is installed under a different name, it
86 looks for resources under that name instead of @samp{emacs}.
89 @item -name @var{name}
91 @itemx --name=@var{name}
92 @cindex resource name, command-line argument
93 Use @var{name} as the resource name (and the title) for the initial
94 Emacs frame. This option does not affect subsequent frames, but Lisp
95 programs can specify frame names when they create frames.
97 If you don't specify this option, the default is to use the Emacs
98 executable's name as the resource name.
100 @item -xrm @var{resource-values}
102 @itemx --xrm=@var{resource-values}
103 @cindex resource values, command-line argument
104 Specify X resource values for this Emacs job (see below).
107 For consistency, @samp{-name} also specifies the name to use for
108 other resource values that do not belong to any particular frame.
110 The resources that name Emacs invocations also belong to a class; its
111 name is @samp{Emacs}. If you write @samp{Emacs} instead of
112 @samp{emacs}, the resource applies to all frames in all Emacs jobs,
113 regardless of frame titles and regardless of the name of the executable
114 file. Here is an example:
121 You can specify a string of additional resource values for Emacs to
122 use with the command line option @samp{-xrm @var{resources}}. The text
123 @var{resources} should have the same format that you would use inside a file
124 of X resources. To include multiple resource specifications in
125 @var{resources}, put a newline between them, just as you would in a file.
126 You can also use @samp{#include "@var{filename}"} to include a file full
127 of resource specifications. Resource values specified with @samp{-xrm}
128 take precedence over all other resource specifications.
130 One way to experiment with the effect of different resource settings
131 is to use the @code{editres} program. Select @samp{Get Tree} from the
132 @samp{Commands} menu, then click on an Emacs frame. This will display
133 a tree showing the structure of X toolkit widgets used in an Emacs
134 frame. Select one of them, such as @samp{menubar}, then select
135 @samp{Show Resource Box} from the @samp{Commands} menu. This displays
136 a list of all the meaningful X resources and allows you to edit them.
137 Changes take effect immediately if you click on the @samp{Apply} button.
139 @node Table of Resources
140 @appendixsec Table of X Resources for Emacs
142 This table lists the resource names that designate options for
143 Emacs, not counting those for the appearance of the menu bar, each
144 with the class that it belongs to:
147 @item @code{background} (class @code{Background})
148 Background color name.
150 @item @code{bitmapIcon} (class @code{BitmapIcon})
151 Use a bitmap icon (a picture of a gnu) if @samp{on}, let the window
152 manager choose an icon if @samp{off}.
154 @item @code{borderColor} (class @code{BorderColor})
155 Color name for the external border.
157 @item @code{borderWidth} (class @code{BorderWidth})
158 Width in pixels of the external border.
160 @item @code{cursorColor} (class @code{Foreground})
161 Color name for text cursor (point).
163 @item @code{font} (class @code{Font})
164 Font name for text (or fontset name, @pxref{Fontsets}).
166 @item @code{foreground} (class @code{Foreground})
169 @item @code{geometry} (class @code{Geometry})
170 Window size and position. Be careful not to specify this resource as
171 @samp{emacs*geometry}, because that may affect individual menus as well
172 as the Emacs frame itself.
174 If this resource specifies a position, that position applies only to the
175 initial Emacs frame (or, in the case of a resource for a specific frame
176 name, only that frame). However, the size, if specified here, applies to
179 @item @code{fullscreen} (class @code{Fullscreen})
180 The desired fullscreen size. The value can be one of @code{fullboth},
181 @code{fullwidth} or @code{fullheight}, which correspond to
182 the command-line options @samp{-fs}, @samp{-fw}, and @samp{-fh}
183 (@pxref{Window Size X}).
185 Note that this applies to all frames created, not just the initial
188 @item @code{iconName} (class @code{Title})
189 Name to display in the icon.
191 @item @code{internalBorder} (class @code{BorderWidth})
192 Width in pixels of the internal border.
194 @item @code{lineSpacing} (class @code{LineSpacing})
197 Additional space (@dfn{leading}) between lines, in pixels.
199 @item @code{menuBar} (class @code{MenuBar})
200 Give frames menu bars if @samp{on}; don't have menu bars if
201 @samp{off}. @xref{Lucid Resources}, and @ref{LessTif Resources}, for
202 how to control the appearance of the menu bar if you have one.
204 @item @code{toolBar} (class @code{ToolBar})
205 Number of lines to reserve for the tool bar. A zero value suppresses
206 the tool bar. If the value is non-zero and
207 @code{auto-resize-tool-bars} is non-@code{nil}, the tool bar's size
208 will be changed automatically so that all tool bar items are visible.
210 @item @code{minibuffer} (class @code{Minibuffer})
211 If @samp{none}, don't make a minibuffer in this frame.
212 It will use a separate minibuffer frame instead.
214 @item @code{paneFont} (class @code{Font})
215 @cindex font for menus
216 Font name for menu pane titles, in non-toolkit versions of Emacs.
218 @item @code{pointerColor} (class @code{Foreground})
219 Color of the mouse cursor.
222 @item @code{privateColormap} (class @code{PrivateColormap})
223 If @samp{on}, use a private color map, in the case where the ``default
224 visual'' of class PseudoColor and Emacs is using it.
227 @item @code{reverseVideo} (class @code{ReverseVideo})
228 Switch foreground and background default colors if @samp{on}, use colors as
229 specified if @samp{off}.
231 @item @code{screenGamma} (class @code{ScreenGamma})
232 @cindex gamma correction
233 Gamma correction for colors, equivalent to the frame parameter
236 @item @code{selectionFont} (class @code{Font})
237 Font name for pop-up menu items, in non-toolkit versions of Emacs. (For
238 toolkit versions, see @ref{Lucid Resources}, also see @ref{LessTif
241 @item @code{synchronous} (class @code{Synchronous})
242 @cindex debugging X problems
243 @cindex synchronous X mode
244 Run Emacs in synchronous mode if @samp{on}. Synchronous mode is
245 useful for debugging X problems.
247 @item @code{title} (class @code{Title})
248 Name to display in the title bar of the initial Emacs frame.
250 @item @code{verticalScrollBars} (class @code{ScrollBars})
251 Give frames scroll bars if @samp{on}; don't have scroll bars if
256 @appendixsec X Resources for Faces
258 You can also use resources to customize the appearance of particular
259 faces (@pxref{Faces}):
262 @item @var{face}.attributeFont
263 Font for face @var{face}.
264 @item @var{face}.attributeForeground
265 Foreground color for face @var{face}.
266 @item @var{face}.attributeBackground
267 Background color for face @var{face}.
268 @item @var{face}.attributeUnderline
269 Underline flag for face @var{face}. Use @samp{on} or @samp{true} for
271 @item @var{face}.attributeFamily
272 Font family for face @var{face}.
273 @item @var{face}.attributeWidth
274 Relative proportional width of the font to use for face @var{face}.
275 It should be one of @code{ultra-condensed}, @code{extra-condensed},
276 @code{condensed}, @code{semi-condensed}, @code{normal},
277 @code{semi-expanded}, @code{expanded}, @code{extra-expanded}, or
278 @code{ultra-expanded}.
279 @item @var{face}.attributeHeight
280 Height of the font to use for face @var{face}: either an integer
281 specifying the height in units of 1/10@dmn{pt}, or a floating point
282 number that specifies a scale factor to scale the underlying face's
283 default font, or a function to be called with the default height which
284 will return a new height.
285 @item @var{face}.attributeWeight
286 A weight to use for the face @var{face}. It must be one of
287 @code{ultra-bold}, @code{extra-bold}, @code{bold},
288 @code{semi-bold}, @code{normal}, @code{semi-light}, @code{light},
289 @code{extra-light}, @code{ultra-light}.
290 @item @var{face}.attributeSlant
291 The slant to use for the font of face @var{face}. It must be one of
292 @code{italic}, @code{oblique}, @code{normal},
293 @code{reverse-italic}, or @code{reverse-oblique}.
294 @item @var{face}.attributeStrikeThrough
295 Whether the face @var{face} should be drawn with a line striking
296 through the characters.
297 @item @var{face}.attributeOverline
298 Whether the characters in the face @var{face} should be overlined.
299 @item @var{face}.attributeBox
300 Whether to draw a box around the characters in face @var{face}.
301 @item @var{face}.attributeInverse
302 Whether to display the characters in face @var{face} in inverse
304 @item @var{face}.attributeStipple
305 The name of a pixmap data file to use for the stipple pattern, or
306 @code{false} to not use stipple for the face @var{face}.
307 @item @var{face}.attributeBackgroundPixmap
308 The background pixmap for the face @var{face}. Should be a name of a
309 pixmap file or @code{false}.
310 @item @var{face}.attributeBold
311 Whether to draw the characters in the face @var{face} as bold.
312 @item @var{face}.attributeItalic
313 Whether to draw the characters in the face @var{face} as italic.
316 @node Lucid Resources
317 @appendixsec Lucid Menu X Resources
318 @cindex Menu X Resources (Lucid widgets)
319 @cindex Lucid Widget X Resources
321 If the Emacs installed at your site was built to use the X toolkit
322 with the Lucid menu widgets, then the menu bar is a separate widget and
323 has its own resources. The resource names contain @samp{pane.menubar}
324 (following, as always, the name of the Emacs invocation, or @samp{Emacs},
325 which stands for all Emacs invocations). Specify them like this:
328 Emacs.pane.menubar.@var{resource}: @var{value}
332 For example, to specify the font @samp{8x16} for the menu-bar items,
336 Emacs.pane.menubar.font: 8x16
340 Resources for @emph{non-menubar} toolkit pop-up menus have
341 @samp{menu*}, in like fashion. For example, to specify the font
342 @samp{8x16} for the pop-up menu items, write this:
345 Emacs.menu*.font: 8x16
349 For dialog boxes, use @samp{dialog} instead of @samp{menu}:
352 Emacs.dialog*.font: 8x16
356 Experience shows that on some systems you may need to add
357 @samp{shell.}@: before the @samp{pane.menubar} or @samp{menu*}. On
358 some other systems, you must not add @samp{shell.}.
360 Here is a list of the specific resources for menu bars and pop-up menus:
364 Font for menu item text.
366 Color of the foreground.
368 Color of the background.
369 @item buttonForeground
370 In the menu bar, the color of the foreground for a selected item.
371 @item horizontalSpacing
372 Horizontal spacing in pixels between items. Default is 3.
373 @item verticalSpacing
374 Vertical spacing in pixels between items. Default is 1.
376 Horizontal spacing between the arrow (which indicates a submenu) and
377 the associated text. Default is 10.
378 @item shadowThickness
379 Thickness of shadow line around the widget.
381 The margin of the menu bar, in characters. The default of 4 makes the
382 menu bar appear like the LessTif/Motif one.
385 @node LessTif Resources
386 @appendixsec LessTif Menu X Resources
387 @cindex Menu X Resources (LessTif widgets)
388 @cindex LessTif Widget X Resources
390 If the Emacs installed at your site was built to use the X toolkit
391 with the LessTif or Motif widgets, then the menu bar, the dialog
392 boxes, the pop-up menus, and the file-selection box are separate
393 widgets and have their own resources.
395 The resource names for the menu bar contain @samp{pane.menubar}
396 (following, as always, the name of the Emacs invocation, or
397 @samp{Emacs}, which stands for all Emacs invocations). Specify them
401 Emacs.pane.menubar.@var{subwidget}.@var{resource}: @var{value}
404 Each individual string in the menu bar is a subwidget; the subwidget's
405 name is the same as the menu item string. For example, the word
406 @samp{File} in the menu bar is part of a subwidget named
407 @samp{emacs.pane.menubar.File}. Most likely, you want to specify the
408 same resources for the whole menu bar. To do this, use @samp{*} instead
409 of a specific subwidget name. For example, to specify the font
410 @samp{8x16} for the menu-bar items, write this:
413 Emacs.pane.menubar.*.fontList: 8x16
417 This also specifies the resource value for submenus.
419 Each item in a submenu in the menu bar also has its own name for X
420 resources; for example, the @samp{File} submenu has an item named
421 @samp{Save (current buffer)}. A resource specification for a submenu
422 item looks like this:
425 Emacs.pane.menubar.popup_*.@var{menu}.@var{item}.@var{resource}: @var{value}
429 For example, here's how to specify the font for the @samp{Save (current
433 Emacs.pane.menubar.popup_*.File.Save (current buffer).fontList: 8x16
437 For an item in a second-level submenu, such as @samp{Complete Word}
438 under @samp{Spell Checking} under @samp{Tools}, the resource fits this
442 Emacs.pane.menubar.popup_*.popup_*.@var{menu}.@var{resource}: @var{value}
449 Emacs.pane.menubar.popup_*.popup_*.Spell Checking.Complete Word: @var{value}
453 (This should be one long line.)
455 It's impossible to specify a resource for all the menu-bar items
456 without also specifying it for the submenus as well. So if you want the
457 submenu items to look different from the menu bar itself, you must ask
458 for that in two steps. First, specify the resource for all of them;
459 then, override the value for submenus alone. Here is an example:
462 Emacs.pane.menubar.*.fontList: 8x16
463 Emacs.pane.menubar.popup_*.fontList: 8x16
467 For LessTif pop-up menus, use @samp{menu*} instead of
468 @samp{pane.menubar}. For example, to specify the font @samp{8x16} for
469 the pop-up menu items, write this:
472 Emacs.menu*.fontList: 8x16
476 For LessTif dialog boxes, use @samp{dialog} instead of @samp{menu}:
479 Emacs.dialog*.fontList: 8x16
480 Emacs.dialog*.foreground: hotpink
483 To specify resources for the LessTif file-selection box, use
484 @samp{fsb*}, like this:
487 Emacs.fsb*.fontList: 8x16
493 Here is a list of the specific resources for LessTif menu bars and
498 The color to show in an armed button.
507 Amount of space to leave around the item, within the border.
509 The width of the border around the menu item, on all sides.
510 @item shadowThickness
511 The width of the border shadow.
512 @item bottomShadowColor
513 The color for the border shadow, on the bottom and the right.
515 The color for the border shadow, on the top and the left.