]> code.delx.au - gnu-emacs/blob - man/xresmini.texi
(ediff-files, ediff-files3, ediff-merge-files)
[gnu-emacs] / man / xresmini.texi
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1987, 1993, 1994, 1995, 1997, 2001, 2002, 2003,
3 @c 2004, 2005, 2006 Free Software Foundation, Inc.
4 @c See file emacs.texi for copying conditions.
5 @node X Resources, Antinews, Emacs Invocation, Top
6 @appendix X Options and Resources
7
8 You can customize some X-related aspects of Emacs behavior using X
9 resources, as is usual for programs that use X. On MS-Windows, you
10 can customize some of the same aspects using the system registry.
11 @xref{MS-Windows Registry}. Likewise, Emacs on MacOS Carbon emulates X
12 resources using the Preferences system. @xref{Mac Environment Variables}.
13
14 When Emacs is built using an ``X toolkit'', such as Lucid or
15 LessTif, you need to use X resources to customize the appearance of
16 the widgets, including the menu-bar, scroll-bar, and dialog boxes.
17 This is because the libraries that implement these don't provide for
18 customization through Emacs. GTK+ widgets use a separate system of
19 ``GTK resources''. In this chapter we describe the most commonly used
20 resource specifications. For full documentation, see the online
21 manual.
22
23 @c Add xref for LessTif/Motif menu resources.
24
25 @menu
26 * Resources:: Using X resources with Emacs (in general).
27 * Table of Resources:: Table of specific X resources that affect Emacs.
28 * Face Resources:: X resources for customizing faces.
29 * Lucid Resources:: X resources for Lucid menus.
30 * GTK resources:: Resources for GTK widgets.
31 @end menu
32
33 @node Resources
34 @appendixsec X Resources
35 @cindex resources
36 @cindex X resources
37 @cindex @file{~/.Xdefaults} file
38 @cindex @file{~/.Xresources} file
39
40 Programs running under the X Window System organize their user
41 options under a hierarchy of classes and resources. You can specify
42 default values for these options in your X resources file, usually
43 named @file{~/.Xdefaults} or @file{~/.Xresources}.
44 If changes in @file{~/.Xdefaults} do not
45 take effect, it is because your X server stores its own list of
46 resources; to update them, use the shell command @command{xrdb}---for
47 instance, @samp{xrdb ~/.Xdefaults}.
48
49 Each line in the file specifies a value for one option or for a
50 collection of related options, for one program or for several programs
51 (optionally even for all programs).
52
53 @cindex Registry (MS-Windows)
54 MS-Windows systems don't support @file{~/.Xdefaults} files, but
55 Emacs compiled for Windows looks for X resources in the Windows
56 Registry, under the key @samp{HKEY_CURRENT_USER\SOFTWARE\GNU\Emacs}
57 and then under the key @samp{HKEY_LOCAL_MACHINE\SOFTWARE\GNU\Emacs}.
58 The menu and scrollbars are native widgets on MS-Windows, so they are
59 only customizable via the system-wide settings in the Display Control
60 Panel. You can also set resources using the @samp{-xrm} command line
61 option (see below.)
62
63 Applications such as Emacs look for resources with specific names
64 and their particular meanings. Case distinctions are significant in
65 these names. Each resource specification in @file{~/.Xdefaults}
66 states the name of the program and the name of the resource. For
67 Emacs, the program name is @samp{Emacs}. It looks like this:
68
69 @example
70 Emacs.borderWidth: 2
71 @end example
72
73 The order in which the lines appear in the file does not matter.
74 Also, command-line options always override the X resources file.
75
76 You can experiment with the effect of different resource settings
77 with the @code{editres} program. Select @samp{Get Tree} from the
78 @samp{Commands} menu, then click on an Emacs frame. This will display
79 a tree showing the structure of X toolkit widgets used in an Emacs
80 frame. Select one of them, such as @samp{menubar}, then select
81 @samp{Show Resource Box} from the @samp{Commands} menu. This displays
82 a list of all the meaningful X resources for that widget, and allows
83 you to edit them. Changes take effect when you click on the
84 @samp{Apply} button. (See the @code{editres} man page for more
85 details.)
86
87 @node Table of Resources
88 @appendixsec Table of X Resources for Emacs
89
90 This table lists the resource names that designate options for
91 Emacs, not counting those for the appearance of the menu bar, each
92 with the class that it belongs to:
93
94 @table @asis
95 @item @code{background} (class @code{Background})
96 Background color name.
97
98 @item @code{borderColor} (class @code{BorderColor})
99 Color name for the external border.
100
101 @item @code{cursorColor} (class @code{Foreground})
102 Color name for text cursor (point).
103
104 @item @code{font} (class @code{Font})
105 Font name (or fontset name, @pxref{Fontsets}) for @code{default} font.
106
107 @item @code{foreground} (class @code{Foreground})
108 Color name for text.
109
110 @item @code{geometry} (class @code{Geometry})
111 Window size and position. Be careful not to specify this resource as
112 @samp{emacs*geometry}, because that may affect individual menus as well
113 as the Emacs frame itself.
114
115 If this resource specifies a position, that position applies only to the
116 initial Emacs frame (or, in the case of a resource for a specific frame
117 name, only that frame). However, the size, if specified here, applies to
118 all frames.
119
120 @item @code{iconName} (class @code{Title})
121 Name to display in the icon.
122
123 @item @code{internalBorder} (class @code{BorderWidth})
124 Width in pixels of the internal border.
125
126 @item @code{lineSpacing} (class @code{LineSpacing})
127 @cindex line spacing
128 @cindex leading
129 Additional space (@dfn{leading}) between lines, in pixels.
130
131 @item @code{menuBar} (class @code{MenuBar})
132 @cindex menu bar
133 Give frames menu bars if @samp{on}; don't have menu bars if
134 @samp{off}. @xref{Lucid Resources}, and @ref{LessTif Resources}, for
135 how to control the appearance of the menu bar if you have one.
136
137 @item @code{pointerColor} (class @code{Foreground})
138 Color of the mouse cursor.
139
140 @item @code{screenGamma} (class @code{ScreenGamma})
141 @cindex gamma correction
142 Gamma correction for colors, equivalent to the frame parameter
143 @code{screen-gamma}.
144
145 @item @code{title} (class @code{Title})
146 Name to display in the title bar of the initial Emacs frame.
147
148 @item @code{toolBar} (class @code{ToolBar})
149 @cindex tool bar
150 Number of lines to reserve for the tool bar. A zero value suppresses
151 the tool bar. If the value is non-zero and
152 @code{auto-resize-tool-bars} is non-@code{nil}, the tool bar's size
153 will be changed automatically so that all tool bar items are visible.
154
155 @item @code{useXIM} (class @code{UseXIM})
156 @cindex XIM
157 @cindex X input methods
158 @cindex input methods, X
159 Turn off use of X input methods (XIM) if @samp{false} or @samp{off}.
160 This is only relevant if your Emacs is actually built with XIM
161 support. It is potentially useful to turn off XIM for efficiency,
162 especially slow X client/server links.
163
164 @item @code{verticalScrollBars} (class @code{ScrollBars})
165 Give frames scroll bars if @samp{on}; don't have scroll bars if
166 @samp{off}.
167 @end table
168
169 @node Face Resources
170 @appendixsec X Resources for Faces
171
172 You can use resources to customize the appearance of particular
173 faces (@pxref{Faces}):
174
175 @table @code
176 @item @var{face}.attributeForeground
177 Foreground color for face @var{face}.
178 @item @var{face}.attributeBackground
179 Background color for face @var{face}.
180 @item @var{face}.attributeUnderline
181 Underline flag for face @var{face}. Use @samp{on} or @samp{true} for
182 yes.
183 @item @var{face}.attributeStrikeThrough
184 @itemx @var{face}.attributeOverline
185 @itemx @var{face}.attributeBox
186 @itemx @var{face}.attributeInverse
187 Likewise, for other boolean font attributes.
188 @item @var{face}.attributeStipple
189 The name of a pixmap data file to use for the stipple pattern, or
190 @code{false} to not use stipple for the face @var{face}.
191 @item @var{face}.attributeBackgroundPixmap
192 The background pixmap for the face @var{face}. Should be a name of a
193 pixmap file or @code{false}.
194 @item @var{face}.attributeFont
195 Font name (full XFD name or valid X abbreviation) for face @var{face}.
196 Instead of this, you can specify the font through separate attributes.
197 @end table
198
199 Instead of using @code{attributeFont} to specify a font name, you can
200 select a font through these separate attributes:
201
202 @table @code
203 @item @var{face}.attributeFamily
204 Font family for face @var{face}.
205 @item @var{face}.attributeHeight
206 Height of the font to use for face @var{face}: either an integer
207 specifying the height in units of 1/10@dmn{pt}, or a floating point
208 number that specifies a scale factor to scale the underlying face's
209 default font, or a function to be called with the default height which
210 will return a new height.
211 @item @var{face}.attributeWidth
212 @itemx @var{face}.attributeWeight
213 @itemx @var{face}.attributeSlant
214 Each of these resources corresponds to a like-named font attribute,
215 and you write the resource value the same as the symbol you would use
216 for the font attribute value.
217 @item @var{face}.attributeBold
218 Bold flag for face @var{face}---instead of @code{attributeWeight}. Use @samp{on} or @samp{true} for
219 yes.
220 @item @var{face}.attributeItalic
221 Italic flag for face @var{face}---instead of @code{attributeSlant}.
222 @end table
223
224 @node Lucid Resources
225 @appendixsec Lucid Menu X Resources
226 @cindex Menu X Resources (Lucid widgets)
227 @cindex Lucid Widget X Resources
228
229 If the Emacs installed at your site was built to use the X toolkit
230 with the Lucid menu widgets, then the menu bar is a separate widget
231 and has its own resources. The resource specifications start with
232 @samp{Emacs.pane.menubar}---for instance, to specify the font
233 @samp{8x16} for the menu-bar items, write this:
234
235 @example
236 Emacs.pane.menubar.font: 8x16
237 @end example
238
239 @noindent
240 Resources for @emph{non-menubar} toolkit pop-up menus have
241 @samp{menu*} instead of @samp{pane.menubar}. For example, to specify
242 the font @samp{8x16} for the pop-up menu items, write this:
243
244 @example
245 Emacs.menu*.font: 8x16
246 @end example
247
248 @noindent
249 For dialog boxes, use @samp{dialog*}:
250
251 @example
252 Emacs.dialog*.font: 8x16
253 @end example
254
255 @noindent
256 The Lucid menus can display multilingual text in your locale. For
257 more information about fontsets see the man page for
258 @code{XCreateFontSet}. To enable multilingual menu text you specify a
259 @code{fontSet} resource instead of the font resource. If both
260 @code{font} and @code{fontSet} resources are specified, the
261 @code{fontSet} resource is used.
262
263 Thus, to specify @samp{-*-helvetica-medium-r-*--*-120-*-*-*-*-*-*,*}
264 for both the popup and menu bar menus, write this:
265
266 @example
267 Emacs*menu*fontSet: -*-helvetica-medium-r-*--*-120-*-*-*-*-*-*,*
268 @end example
269
270 @noindent
271 The @samp{*menu*} as a wildcard matches @samp{pane.menubar} and
272 @samp{menu@dots{}}.
273
274 Experience shows that on some systems you may need to add
275 @samp{shell.}@: before the @samp{pane.menubar} or @samp{menu*}. On
276 some other systems, you must not add @samp{shell.}. The generic wildcard
277 approach should work on both kinds of systems.
278
279 Here is a list of the specific resources for menu bars and pop-up menus:
280
281 @table @code
282 @item font
283 Font for menu item text.
284 @item fontSet
285 Fontset for menu item text.
286 @item foreground
287 Color of the foreground.
288 @item background
289 Color of the background.
290 @item buttonForeground
291 In the menu bar, the color of the foreground for a selected item.
292 @item margin
293 The margin of the menu bar, in characters. Default is 1.
294 @end table
295
296 @node GTK resources
297 @appendixsec GTK resources
298
299 @c Waiting for contents
300
301 @ignore
302 arch-tag: e1856f29-2482-42c0-a990-233cdccd1f21
303 @end ignore