Commit | Line | Data |
---|---|---|
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 |
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. | |
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 |
31 | options under a hierarchy of classes and resources. You can specify | |
32 | default values for these options in your X resources file, usually | |
02e740dc DL |
33 | named @file{~/.Xdefaults} or @file{~/.Xresources}. |
34 | If changes in @file{~/.Xdefaults} do not | |
9b7e4229 RS |
35 | take effect, it is because your X server stores its own list of |
36 | resources; to update them, use the shell command @command{xrdb}---for | |
37 | instance, @samp{xrdb ~/.Xdefaults}. | |
94249313 RS |
38 | |
39 | Each line in the file specifies a value for one option or for a | |
40 | collection 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 |
45 | Emacs compiled for Windows looks for X resources in the Windows | |
eca274b1 RS |
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}. | |
94249313 RS |
48 | |
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 | |
55 | names. | |
56 | ||
57 | In @file{~/.Xdefaults}, you can specify a value for a single resource | |
58 | on one line, like this: | |
59 | ||
60 | @example | |
61 | emacs.borderWidth: 2 | |
62 | @end example | |
63 | ||
64 | @noindent | |
65 | Or you can use a class name to specify the same value for all resources | |
66 | in that class. Here's an example: | |
67 | ||
68 | @example | |
69 | emacs.BorderWidth: 2 | |
70 | @end example | |
71 | ||
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: | |
77 | ||
78 | @example | |
79 | emacs.BorderWidth: 2 | |
80 | emacs.borderWidth: 4 | |
81 | @end example | |
82 | ||
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. | |
85 | ||
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}. | |
90 | ||
91 | @table @samp | |
92 | @item -name @var{name} | |
93 | @opindex --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. | |
99 | ||
100 | If you don't specify this option, the default is to use the Emacs | |
101 | executable'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 | |
107 | Specify 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 | |
111 | other resource values that do not belong to any particular frame. | |
112 | ||
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: | |
118 | ||
119 | @example | |
120 | Emacs.BorderWidth: 2 | |
121 | Emacs.borderWidth: 4 | |
122 | @end example | |
123 | ||
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. | |
132 | ||
82f6e63d RS |
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. | |
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 |
146 | Emacs, not counting those for the appearance of the menu bar, each |
147 | with the class that it belongs to: | |
94249313 RS |
148 | |
149 | @table @asis | |
150 | @item @code{background} (class @code{Background}) | |
151 | Background color name. | |
152 | ||
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}. | |
156 | ||
157 | @item @code{borderColor} (class @code{BorderColor}) | |
158 | Color name for the external border. | |
159 | ||
160 | @item @code{borderWidth} (class @code{BorderWidth}) | |
161 | Width in pixels of the external border. | |
162 | ||
163 | @item @code{cursorColor} (class @code{Foreground}) | |
164 | Color name for text cursor (point). | |
165 | ||
166 | @item @code{font} (class @code{Font}) | |
167 | Font name for text (or fontset name, @pxref{Fontsets}). | |
168 | ||
169 | @item @code{foreground} (class @code{Foreground}) | |
170 | Color name for text. | |
171 | ||
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. | |
176 | ||
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 | |
180 | all frames. | |
181 | ||
e1556251 | 182 | @item @code{fullscreen} (class @code{Fullscreen}) |
cf225974 EZ |
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}). | |
e1556251 EZ |
187 | |
188 | Note that this applies to all frames created, not just the initial | |
189 | one. | |
190 | ||
94249313 RS |
191 | @item @code{iconName} (class @code{Title}) |
192 | Name to display in the icon. | |
193 | ||
194 | @item @code{internalBorder} (class @code{BorderWidth}) | |
195 | Width in pixels of the internal border. | |
196 | ||
197 | @item @code{lineSpacing} (class @code{LineSpacing}) | |
198 | @cindex line spacing | |
199 | @cindex leading | |
200 | Additional space (@dfn{leading}) between lines, in pixels. | |
201 | ||
202 | @item @code{menuBar} (class @code{MenuBar}) | |
9b7e4229 RS |
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. | |
94249313 | 206 | |
94249313 RS |
207 | @item @code{minibuffer} (class @code{Minibuffer}) |
208 | If @samp{none}, don't make a minibuffer in this frame. | |
209 | It will use a separate minibuffer frame instead. | |
210 | ||
211 | @item @code{paneFont} (class @code{Font}) | |
212 | @cindex font for menus | |
213 | Font name for menu pane titles, in non-toolkit versions of Emacs. | |
214 | ||
215 | @item @code{pointerColor} (class @code{Foreground}) | |
216 | Color of the mouse cursor. | |
217 | ||
94249313 RS |
218 | @item @code{privateColormap} (class @code{PrivateColormap}) |
219 | If @samp{on}, use a private color map, in the case where the ``default | |
220 | visual'' of class PseudoColor and Emacs is using it. | |
94249313 RS |
221 | |
222 | @item @code{reverseVideo} (class @code{ReverseVideo}) | |
223 | Switch foreground and background default colors if @samp{on}, use colors as | |
224 | specified if @samp{off}. | |
225 | ||
226 | @item @code{screenGamma} (class @code{ScreenGamma}) | |
227 | @cindex gamma correction | |
228 | Gamma correction for colors, equivalent to the frame parameter | |
229 | @code{screen-gamma}. | |
230 | ||
02e740dc | 231 | @item @code{selectionFont} (class @code{SelectionFont}) |
94249313 RS |
232 | Font name for pop-up menu items, in non-toolkit versions of Emacs. (For |
233 | toolkit versions, see @ref{Lucid Resources}, also see @ref{LessTif | |
234 | Resources}.) | |
235 | ||
02e740dc DL |
236 | @item @code{selectionTimeout} (class @code{SelectionTimeout}) |
237 | Number of milliseconds to wait for a selection reply. | |
238 | If the selection owner doesn't reply in this time, we give up. | |
239 | A 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 | |
244 | Run Emacs in synchronous mode if @samp{on}. Synchronous mode is | |
245 | useful for debugging X problems. | |
246 | ||
247 | @item @code{title} (class @code{Title}) | |
248 | Name to display in the title bar of the initial Emacs frame. | |
249 | ||
4fc31427 RS |
250 | @item @code{toolBar} (class @code{ToolBar}) |
251 | Number of lines to reserve for the tool bar. A zero value suppresses | |
252 | the tool bar. If the value is non-zero and | |
253 | @code{auto-resize-tool-bars} is non-@code{nil}, the tool bar's size | |
254 | will be changed automatically so that all tool bar items are visible. | |
255 | ||
94249313 RS |
256 | @item @code{verticalScrollBars} (class @code{ScrollBars}) |
257 | Give 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 | |
265 | faces (@pxref{Faces}): | |
94249313 RS |
266 | |
267 | @table @code | |
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 | |
276 | yes. | |
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 | |
309 | video. | |
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. | |
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 | |
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: | |
332 | ||
333 | @example | |
334 | Emacs.pane.menubar.@var{resource}: @var{value} | |
335 | @end example | |
336 | ||
337 | @noindent | |
338 | For example, to specify the font @samp{8x16} for the menu-bar items, | |
339 | write this: | |
340 | ||
341 | @example | |
342 | Emacs.pane.menubar.font: 8x16 | |
343 | @end example | |
344 | ||
345 | @noindent | |
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: | |
349 | ||
350 | @example | |
351 | Emacs.menu*.font: 8x16 | |
352 | @end example | |
353 | ||
354 | @noindent | |
355 | For dialog boxes, use @samp{dialog} instead of @samp{menu}: | |
356 | ||
357 | @example | |
358 | Emacs.dialog*.font: 8x16 | |
359 | @end example | |
360 | ||
361 | @noindent | |
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.}. | |
365 | ||
366 | Here is a list of the specific resources for menu bars and pop-up menus: | |
367 | ||
368 | @table @code | |
369 | @item font | |
370 | Font for menu item text. | |
371 | @item foreground | |
372 | Color of the foreground. | |
373 | @item background | |
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. | |
381 | @item arrowSpacing | |
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. | |
386 | @item margin | |
387 | The margin of the menu bar, in characters. The default of 4 makes the | |
388 | menu 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 | |
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. | |
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 | |
404 | like this: | |
405 | ||
406 | @smallexample | |
407 | Emacs.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 | |
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: | |
417 | ||
418 | @smallexample | |
419 | Emacs.pane.menubar.*.fontList: 8x16 | |
420 | @end smallexample | |
421 | ||
422 | @noindent | |
423 | This 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 | |
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: | |
429 | ||
430 | @smallexample | |
431 | Emacs.pane.menubar.popup_*.@var{menu}.@var{item}.@var{resource}: @var{value} | |
432 | @end smallexample | |
433 | ||
434 | @noindent | |
435 | For example, here's how to specify the font for the @samp{Save (current | |
436 | buffer)} item: | |
437 | ||
438 | @smallexample | |
439 | Emacs.pane.menubar.popup_*.File.Save (current buffer).fontList: 8x16 | |
440 | @end smallexample | |
441 | ||
442 | @noindent | |
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 | |
445 | template: | |
446 | ||
447 | @smallexample | |
448 | Emacs.pane.menubar.popup_*.popup_*.@var{menu}.@var{resource}: @var{value} | |
449 | @end smallexample | |
450 | ||
451 | @noindent | |
452 | For example, | |
453 | ||
454 | @smallexample | |
455 | Emacs.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 | |
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: | |
466 | ||
467 | @smallexample | |
468 | Emacs.pane.menubar.*.fontList: 8x16 | |
469 | Emacs.pane.menubar.popup_*.fontList: 8x16 | |
470 | @end smallexample | |
471 | ||
472 | @noindent | |
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: | |
476 | ||
477 | @smallexample | |
478 | Emacs.menu*.fontList: 8x16 | |
479 | @end smallexample | |
480 | ||
481 | @noindent | |
482 | For LessTif dialog boxes, use @samp{dialog} instead of @samp{menu}: | |
483 | ||
484 | @example | |
485 | Emacs.dialog*.fontList: 8x16 | |
486 | Emacs.dialog*.foreground: hotpink | |
487 | @end example | |
488 | ||
489 | To specify resources for the LessTif file-selection box, use | |
490 | @samp{fsb*}, like this: | |
491 | ||
492 | @example | |
493 | Emacs.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 | |
500 | pop-up menus: | |
501 | ||
502 | @table @code | |
503 | @item armColor | |
504 | The color to show in an armed button. | |
505 | @item fontList | |
506 | The font to use. | |
507 | @item marginBottom | |
508 | @itemx marginHeight | |
509 | @itemx marginLeft | |
510 | @itemx marginRight | |
511 | @itemx marginTop | |
512 | @itemx marginWidth | |
513 | Amount of space to leave around the item, within the border. | |
514 | @item borderWidth | |
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. | |
520 | @item topShadowColor | |
521 | The color for the border shadow, on the top and the left. | |
522 | @end table |