(reb-match-0, reb-match-1)
[bpt/emacs.git] / man / xresources.texi
CommitLineData
94249313
RS
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
82f6e63d 5@appendix X Options and Resources
94249313 6
82f6e63d
RS
7 You can customize some X-related aspects of Emacs behavior using X
8resources, as is usual for programs that use X. X resources are the
9only way to customize tooltip windows and LessTif menus, since the
10libraries that implement them don't provide for customization through
11Emacs. This appendix describes the X resources that Emacs recognizes
12and how to use them.
405f4489
RS
13
14@menu
82f6e63d
RS
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.
405f4489
RS
18* Lucid Resources:: X resources for Lucid menus.
19* LessTif Resources:: X resources for LessTif and Motif menus.
20@end menu
21
94249313
RS
22@node Resources X
23@appendixsec X Resources
24@cindex resources
25
26@cindex X resources, @file{~/.Xdefaults} file
27 Programs running under the X Window System organize their user options
28under a hierarchy of classes and resources. You can specify default
29values for these options in your X resources file, usually named
30@file{~/.Xdefaults}.
31
32 Each line in the file specifies a value for one option or for a
33collection of related options, for one program or for several programs
34(optionally even for all programs).
35
36@cindex Registry (MS-Windows)
37@cindex @file{.Xdefaults} file, and MS-Windows
38 MS-Windows systems don't support @file{~/.Xdefaults} files, but
39Emacs compiled for Windows looks for X resources in the Windows
40Registry, under the keys @samp{HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs}
41and @samp{HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs}.
42
43 Programs define named resources with particular meanings. They also
44define how to group resources into named classes. For instance, in
45Emacs, the @samp{internalBorder} resource controls the width of the
46internal border, and the @samp{borderWidth} resource controls the width
47of the external border. Both of these resources are part of the
48@samp{BorderWidth} class. Case distinctions are significant in these
49names.
50
51 In @file{~/.Xdefaults}, you can specify a value for a single resource
52on one line, like this:
53
54@example
55emacs.borderWidth: 2
56@end example
57
58@noindent
59Or you can use a class name to specify the same value for all resources
60in that class. Here's an example:
61
62@example
63emacs.BorderWidth: 2
64@end example
65
66 If you specify a value for a class, it becomes the default for all
67resources in that class. You can specify values for individual
68resources as well; these override the class value, for those particular
69resources. Thus, this example specifies 2 as the default width for all
70borders, but overrides this value with 4 for the external border:
71
72@example
73emacs.BorderWidth: 2
74emacs.borderWidth: 4
75@end example
76
77 The order in which the lines appear in the file does not matter.
78Also, command-line options always override the X resources file.
79
80 The string @samp{emacs} in the examples above is also a resource
81name. It actually represents the name of the executable file that you
82invoke to run Emacs. If Emacs is installed under a different name, it
83looks for resources under that name instead of @samp{emacs}.
84
85@table @samp
86@item -name @var{name}
87@opindex --name
88@itemx --name=@var{name}
89@cindex resource name, command-line argument
90Use @var{name} as the resource name (and the title) for the initial
91Emacs frame. This option does not affect subsequent frames, but Lisp
92programs can specify frame names when they create frames.
93
94If you don't specify this option, the default is to use the Emacs
95executable's name as the resource name.
96
97@item -xrm @var{resource-values}
98@opindex --xrm
99@itemx --xrm=@var{resource-values}
100@cindex resource values, command-line argument
101Specify X resource values for this Emacs job (see below).
102@end table
103
104 For consistency, @samp{-name} also specifies the name to use for
105other resource values that do not belong to any particular frame.
106
107 The resources that name Emacs invocations also belong to a class; its
108name is @samp{Emacs}. If you write @samp{Emacs} instead of
109@samp{emacs}, the resource applies to all frames in all Emacs jobs,
110regardless of frame titles and regardless of the name of the executable
111file. Here is an example:
112
113@example
114Emacs.BorderWidth: 2
115Emacs.borderWidth: 4
116@end example
117
118 You can specify a string of additional resource values for Emacs to
119use with the command line option @samp{-xrm @var{resources}}. The text
120@var{resources} should have the same format that you would use inside a file
121of X resources. To include multiple resource specifications in
122@var{resources}, put a newline between them, just as you would in a file.
123You can also use @samp{#include "@var{filename}"} to include a file full
124of resource specifications. Resource values specified with @samp{-xrm}
125take precedence over all other resource specifications.
126
82f6e63d
RS
127 One way to experiment with the effect of different resource settings
128is to use the @code{editres} program. Select @samp{Get Tree} from the
129@samp{Commands} menu, then click on an Emacs frame. This will display
130a tree showing the structure of X toolkit widgets used in an Emacs
131frame. Select one of them, such as @samp{menubar}, then select
132@samp{Show Resource Box} from the @samp{Commands} menu. This displays
133a list of all the meaningful X resources and allows you to edit them.
134Changes take effect immediately if you click on the @samp{Apply} button.
135
136@node Table of Resources
137@appendixsec Table of X Resources for Emacs
138
139 This table lists the resource names that designate options for
140Emacs, each with the class that it belongs to:
94249313
RS
141
142@table @asis
143@item @code{background} (class @code{Background})
144Background color name.
145
146@item @code{bitmapIcon} (class @code{BitmapIcon})
147Use a bitmap icon (a picture of a gnu) if @samp{on}, let the window
148manager choose an icon if @samp{off}.
149
150@item @code{borderColor} (class @code{BorderColor})
151Color name for the external border.
152
153@item @code{borderWidth} (class @code{BorderWidth})
154Width in pixels of the external border.
155
156@item @code{cursorColor} (class @code{Foreground})
157Color name for text cursor (point).
158
159@item @code{font} (class @code{Font})
160Font name for text (or fontset name, @pxref{Fontsets}).
161
162@item @code{foreground} (class @code{Foreground})
163Color name for text.
164
165@item @code{geometry} (class @code{Geometry})
166Window size and position. Be careful not to specify this resource as
167@samp{emacs*geometry}, because that may affect individual menus as well
168as the Emacs frame itself.
169
170If this resource specifies a position, that position applies only to the
171initial Emacs frame (or, in the case of a resource for a specific frame
172name, only that frame). However, the size, if specified here, applies to
173all frames.
174
175@item @code{iconName} (class @code{Title})
176Name to display in the icon.
177
178@item @code{internalBorder} (class @code{BorderWidth})
179Width in pixels of the internal border.
180
181@item @code{lineSpacing} (class @code{LineSpacing})
182@cindex line spacing
183@cindex leading
184Additional space (@dfn{leading}) between lines, in pixels.
185
186@item @code{menuBar} (class @code{MenuBar})
187Give frames menu bars if @samp{on}; don't have menu bars if @samp{off}.
188
189@item @code{toolBar} (class @code{ToolBar})
190Number of lines to reserve for the tool bar. A zero value suppresses
191the tool bar. If the value is non-zero and
192@code{auto-resize-tool-bars} is non-@code{nil}, the tool bar's size
193will be changed automatically so that all tool bar items are visible.
194
195@item @code{minibuffer} (class @code{Minibuffer})
196If @samp{none}, don't make a minibuffer in this frame.
197It will use a separate minibuffer frame instead.
198
199@item @code{paneFont} (class @code{Font})
200@cindex font for menus
201Font name for menu pane titles, in non-toolkit versions of Emacs.
202
203@item @code{pointerColor} (class @code{Foreground})
204Color of the mouse cursor.
205
206@ignore
207@item @code{privateColormap} (class @code{PrivateColormap})
208If @samp{on}, use a private color map, in the case where the ``default
209visual'' of class PseudoColor and Emacs is using it.
210@end ignore
211
212@item @code{reverseVideo} (class @code{ReverseVideo})
213Switch foreground and background default colors if @samp{on}, use colors as
214specified if @samp{off}.
215
216@item @code{screenGamma} (class @code{ScreenGamma})
217@cindex gamma correction
218Gamma correction for colors, equivalent to the frame parameter
219@code{screen-gamma}.
220
221@item @code{selectionFont} (class @code{Font})
222Font name for pop-up menu items, in non-toolkit versions of Emacs. (For
223toolkit versions, see @ref{Lucid Resources}, also see @ref{LessTif
224Resources}.)
225
226@item @code{synchronous} (class @code{Synchronous})
227@cindex debugging X problems
228@cindex synchronous X mode
229Run Emacs in synchronous mode if @samp{on}. Synchronous mode is
230useful for debugging X problems.
231
232@item @code{title} (class @code{Title})
233Name to display in the title bar of the initial Emacs frame.
234
235@item @code{verticalScrollBars} (class @code{ScrollBars})
236Give frames scroll bars if @samp{on}; don't have scroll bars if
237@samp{off}.
238@end table
239
82f6e63d
RS
240@node Face Resources
241@appendixsec X Resources for Faces
242
243 You can also use resources to customize the appearance of particular
244faces (@pxref{Faces}):
94249313
RS
245
246@table @code
247@item @var{face}.attributeFont
248Font for face @var{face}.
249@item @var{face}.attributeForeground
250Foreground color for face @var{face}.
251@item @var{face}.attributeBackground
252Background color for face @var{face}.
253@item @var{face}.attributeUnderline
254Underline flag for face @var{face}. Use @samp{on} or @samp{true} for
255yes.
256@item @var{face}.attributeFamily
257Font family for face @var{face}.
258@item @var{face}.attributeWidth
259Relative proportional width of the font to use for face @var{face}.
260It should be one of @code{ultra-condensed}, @code{extra-condensed},
261@code{condensed}, @code{semi-condensed}, @code{normal},
262@code{semi-expanded}, @code{expanded}, @code{extra-expanded}, or
263@code{ultra-expanded}.
264@item @var{face}.attributeHeight
265Height of the font to use for face @var{face}: either an integer
266specifying the height in units of 1/10@dmn{pt}, or a floating point
267number that specifies a scale factor to scale the underlying face's
268default font, or a function to be called with the default height which
269will return a new height.
270@item @var{face}.attributeWeight
271A weight to use for the face @var{face}. It must be one of
272@code{ultra-bold}, @code{extra-bold}, @code{bold},
273@code{semi-bold}, @code{normal}, @code{semi-light}, @code{light},
274@code{extra-light}, @code{ultra-light}.
275@item @var{face}.attributeSlant
276The slant to use for the font of face @var{face}. It must be one of
277@code{italic}, @code{oblique}, @code{normal},
278@code{reverse-italic}, or @code{reverse-oblique}.
279@item @var{face}.attributeStrikeThrough
280Whether the face @var{face} should be drawn with a line striking
281through the characters.
282@item @var{face}.attributeOverline
283Whether the characters in the face @var{face} should be overlined.
284@item @var{face}.attributeBox
285Whether to draw a box around the characters in face @var{face}.
286@item @var{face}.attributeInverse
287Whether to display the characters in face @var{face} in inverse
288video.
289@item @var{face}.attributeStipple
290The name of a pixmap data file to use for the stipple pattern, or
291@code{false} to not use stipple for the face @var{face}.
292@item @var{face}.attributeBackgroundPixmap
293The background pixmap for the face @var{face}. Should be a name of a
294pixmap file or @code{false}.
295@item @var{face}.attributeBold
296Whether to draw the characters in the face @var{face} as bold.
297@item @var{face}.attributeItalic
298Whether to draw the characters in the face @var{face} as italic.
299@end table
300
301@node Lucid Resources
302@appendixsec Lucid Menu X Resources
303@cindex Menu X Resources (Lucid widgets)
304@cindex Lucid Widget X Resources
305
306 If the Emacs installed at your site was built to use the X toolkit
307with the Lucid menu widgets, then the menu bar is a separate widget and
308has its own resources. The resource names contain @samp{pane.menubar}
309(following, as always, the name of the Emacs invocation, or @samp{Emacs},
310which stands for all Emacs invocations). Specify them like this:
311
312@example
313Emacs.pane.menubar.@var{resource}: @var{value}
314@end example
315
316@noindent
317For example, to specify the font @samp{8x16} for the menu-bar items,
318write this:
319
320@example
321Emacs.pane.menubar.font: 8x16
322@end example
323
324@noindent
325Resources for @emph{non-menubar} toolkit pop-up menus have
326@samp{menu*}, in like fashion. For example, to specify the font
327@samp{8x16} for the pop-up menu items, write this:
328
329@example
330Emacs.menu*.font: 8x16
331@end example
332
333@noindent
334For dialog boxes, use @samp{dialog} instead of @samp{menu}:
335
336@example
337Emacs.dialog*.font: 8x16
338@end example
339
340@noindent
341Experience shows that on some systems you may need to add
342@samp{shell.}@: before the @samp{pane.menubar} or @samp{menu*}. On
343some other systems, you must not add @samp{shell.}.
344
345 Here is a list of the specific resources for menu bars and pop-up menus:
346
347@table @code
348@item font
349Font for menu item text.
350@item foreground
351Color of the foreground.
352@item background
353Color of the background.
354@item buttonForeground
355In the menu bar, the color of the foreground for a selected item.
356@item horizontalSpacing
357Horizontal spacing in pixels between items. Default is 3.
358@item verticalSpacing
359Vertical spacing in pixels between items. Default is 1.
360@item arrowSpacing
361Horizontal spacing between the arrow (which indicates a submenu) and
362the associated text. Default is 10.
363@item shadowThickness
364Thickness of shadow line around the widget.
365@item margin
366The margin of the menu bar, in characters. The default of 4 makes the
367menu bar appear like the LessTif/Motif one.
368@end table
369
370@node LessTif Resources
371@appendixsec LessTif Menu X Resources
372@cindex Menu X Resources (LessTif widgets)
373@cindex LessTif Widget X Resources
374
375 If the Emacs installed at your site was built to use the X toolkit
376with the LessTif or Motif widgets, then the menu bar, the dialog
377boxes, the pop-up menus, and the file-selection box are separate
378widgets and have their own resources.
379
380 The resource names for the menu bar contain @samp{pane.menubar}
381(following, as always, the name of the Emacs invocation, or
382@samp{Emacs}, which stands for all Emacs invocations). Specify them
383like this:
384
385@smallexample
386Emacs.pane.menubar.@var{subwidget}.@var{resource}: @var{value}
387@end smallexample
388
389 Each individual string in the menu bar is a subwidget; the subwidget's
390name is the same as the menu item string. For example, the word
391@samp{File} in the menu bar is part of a subwidget named
392@samp{emacs.pane.menubar.File}. Most likely, you want to specify the
393same resources for the whole menu bar. To do this, use @samp{*} instead
394of a specific subwidget name. For example, to specify the font
395@samp{8x16} for the menu-bar items, write this:
396
397@smallexample
398Emacs.pane.menubar.*.fontList: 8x16
399@end smallexample
400
401@noindent
402This also specifies the resource value for submenus.
403
404 Each item in a submenu in the menu bar also has its own name for X
405resources; for example, the @samp{File} submenu has an item named
406@samp{Save (current buffer)}. A resource specification for a submenu
407item looks like this:
408
409@smallexample
410Emacs.pane.menubar.popup_*.@var{menu}.@var{item}.@var{resource}: @var{value}
411@end smallexample
412
413@noindent
414For example, here's how to specify the font for the @samp{Save (current
415buffer)} item:
416
417@smallexample
418Emacs.pane.menubar.popup_*.File.Save (current buffer).fontList: 8x16
419@end smallexample
420
421@noindent
422For an item in a second-level submenu, such as @samp{Complete Word}
423under @samp{Spell Checking} under @samp{Tools}, the resource fits this
424template:
425
426@smallexample
427Emacs.pane.menubar.popup_*.popup_*.@var{menu}.@var{resource}: @var{value}
428@end smallexample
429
430@noindent
431For example,
432
433@smallexample
434Emacs.pane.menubar.popup_*.popup_*.Spell Checking.Complete Word: @var{value}
435@end smallexample
436
437@noindent
438(This should be one long line.)
439
440 It's impossible to specify a resource for all the menu-bar items
441without also specifying it for the submenus as well. So if you want the
442submenu items to look different from the menu bar itself, you must ask
443for that in two steps. First, specify the resource for all of them;
444then, override the value for submenus alone. Here is an example:
445
446@smallexample
447Emacs.pane.menubar.*.fontList: 8x16
448Emacs.pane.menubar.popup_*.fontList: 8x16
449@end smallexample
450
451@noindent
452For LessTif pop-up menus, use @samp{menu*} instead of
453@samp{pane.menubar}. For example, to specify the font @samp{8x16} for
454the pop-up menu items, write this:
455
456@smallexample
457Emacs.menu*.fontList: 8x16
458@end smallexample
459
460@noindent
461For LessTif dialog boxes, use @samp{dialog} instead of @samp{menu}:
462
463@example
464Emacs.dialog*.fontList: 8x16
465Emacs.dialog*.foreground: hotpink
466@end example
467
468To specify resources for the LessTif file-selection box, use
469@samp{fsb*}, like this:
470
471@example
472Emacs.fsb*.fontList: 8x16
473@end example
474
475@iftex
476@medbreak
477@end iftex
478 Here is a list of the specific resources for LessTif menu bars and
479pop-up menus:
480
481@table @code
482@item armColor
483The color to show in an armed button.
484@item fontList
485The font to use.
486@item marginBottom
487@itemx marginHeight
488@itemx marginLeft
489@itemx marginRight
490@itemx marginTop
491@itemx marginWidth
492Amount of space to leave around the item, within the border.
493@item borderWidth
494The width of the border around the menu item, on all sides.
495@item shadowThickness
496The width of the border shadow.
497@item bottomShadowColor
498The color for the border shadow, on the bottom and the right.
499@item topShadowColor
500The color for the border shadow, on the top and the left.
501@end table