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