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