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