*** empty log message ***
[gnus] / texi / custom.texi
1 \input texinfo.tex
2
3 @c %**start of header
4 @setfilename custom.info
5 @settitle The Customization Library
6 @iftex
7 @afourpaper
8 @headings double
9 @end iftex
10 @c %**end of header
11
12 @node Top, Introduction, (dir), (dir)
13 @comment  node-name,  next,  previous,  up
14 @top The Customization Library
15
16 Version: 0.9
17
18 @menu
19 * Introduction::                
20 * User Commands::               
21 * The Customization Buffer::    
22 * Declaring Groups::            
23 * Declaring Variables::         
24 * Declaring Faces::             
25 * The Init File::               
26 * Wishlist::                    
27 @end menu
28
29 @node   Introduction, User Commands, Top, Top
30 @comment  node-name,  next,  previous,  up
31 @section Introduction
32
33 This library allows customization of @dfn{user options}.  Currently two
34 types of user options are supported, namely @dfn{variables} and
35 @dfn{faces}.  Each user option can have four different values
36 simultaneously:
37 @table @dfn
38 @item factory setting
39 The value specified by the programmer.
40 @item default value
41 The value specified by the user as the default for this variable.  This
42 overwrites the factory setting when starting a new emacs.
43 @item current value
44 The value used by Emacs.  This will not be remembered next time you
45 run Emacs.
46 @item widget value
47 The value entered by the user in a customization buffer, but not yet
48 applied.
49 @end table
50
51 Variables also have a @dfn{type}, which specifies what kind of values
52 the variable can hold, and how the value is presented in a customization
53 buffer.  By default a variable can hold any valid expression, but the
54 programmer can specify a more limited type when declaring the variable.
55
56 The user options are organized in a number of @dfn{groups}.  Each group
57 can contain a number user options, as well as other groups.  The groups
58 allows the user to concentrate on a specific part of emacs.
59
60 @node  User Commands, The Customization Buffer, Introduction, Top
61 @comment  node-name,  next,  previous,  up
62 @section User Commands
63
64 The following commands will create a customization buffer:
65
66 @table @code
67 @item customize
68 Create a customization buffer containing a specific group, by default
69 the @code{emacs} group.
70
71 @item customize-variable
72 Create a customization buffer containing a single variable.  
73
74 @item customize-face
75 Create a customization buffer contaning a single face.
76
77 @item customize-apropos
78 Create a customization buffer containing all variables, faces, and
79 groups that match a user specified regular expression.
80 @end table
81
82 @node  The Customization Buffer, Declaring Groups, User Commands, Top
83 @comment  node-name,  next,  previous,  up
84 @section The Customization Buffer.
85
86 Here should be a description of how to use a customization buffer. 
87 For now, try to press @kbd{C-h m} in the buffer, or read @ref{User
88 Interface,,widget,The Widget Library}. 
89
90 The interface will change, as it currently stinks.  Here is some hints
91 about how to use it though:
92
93 @itemize @bullet
94 @item
95 Groups and user option start on a new line, and look like this
96 @t{@b{name}:}.  If you move point above to the @t{@b{name}} and press
97 @kbd{@key{RET}}, or move the mouse pointer above it and press
98 @kbd{mouse-2}, you will be presented with a menu.  I call this the
99 @dfn{tag menu} below. 
100
101 @item
102 For groups and faces, you need to activate @samp{Toggle Hide} from the
103 tag menu to be able to see the content.
104
105 @item
106 After editing a variable or face, you must activate @samp{Apply} for the
107 setting to take effect, and @samp{Set Default} for marking the widget
108 value as the new default value.
109
110 @item
111 After setting new default values with @samp{Set Default}, you must
112 activate the @samp{Save} button in the bottom of the screen to save the
113 new defaults.  Otherwise the new defaults will be silently forgotten.
114
115 @item
116 Pushing @samp{Save} is a no-op unless you have activated @samp{Set Default}
117 for some user option.
118
119 @item
120 The @code{face} widget never attempts to display the current value of a
121 face.  Instead it allows you to specify how the face should be
122 initialized.  This is done with a list of @dfn{display} and
123 @dfn{attributes} pairs, where the first display that matches a frame
124 specify the attributes to use for that frame.
125
126 A display can either match all frames, or only frames with a given
127 @dfn{type}, @dfn{class}, and @dfn{background}.  The checkbox before each
128 of these display parameters determine whether the parameter will be
129 checked.  If the checkbox before @samp{Type} is unchecked, the display
130 will match all types of frames.  If it is checked, it will match the
131 type of frames specified on the rest of the line.
132
133 The attributes are specified next.  Each attribute line begins with a
134 checkbox, if that checkbox is unchecked the face will not affect that
135 particular attribute on the screen, otherwise the face will force the
136 the text to have the value for attribute specified after the attrbute
137 name.  This means that an attribute like @samp{bold} in effect have
138 three states: If the first checkmark is unchecked, the face will not
139 affect the boldness of the text.  If the first checkmark is checked, but
140 the second is unchecked, the text will be forced to be unbold.  If both
141 checkmarks are checked, the text will be forced to be bold.
142
143 Think about this, and mail me a suggestion for how to make the face
144 widget more intuitive. 
145 @end itemize
146
147 @node  Declaring Groups, Declaring Variables, The Customization Buffer, Top
148 @comment  node-name,  next,  previous,  up
149 @section Declaring Groups
150
151 Use @code{defgroup} to declare new customization groups. 
152
153 @defun defgroup symbol members [keyword value]... doc
154 Declare @var{symbol} as a customization group containing @var{members}. 
155 @var{symbol} does not need to be quoted.
156
157 @var{members} should be an alist of the form ((@var{name}
158 @var{widget})...) where @var{name} is a symbol and @var{widget} is a
159 widget for editing that symbol.  Useful widgets are
160 @code{custom-variable} for editing variables, @code{custom-face} for
161 editing faces, and @code{custom-group} for editing groups.@refill
162
163 @var{doc} is the group documentation.
164
165 The following @var{keyword}'s are defined:
166
167 @table @code
168 @item :group
169 @var{value} should be a customization group. 
170 Add @var{symbol} to that group. 
171 @end table
172 @end defun
173
174 Internally, custom uses the symbol property @code{custom-group} to keep
175 track of the group members, and @code{group-documentation} for the
176 documentation string. 
177
178 @node  Declaring Variables, Declaring Faces, Declaring Groups, Top
179 @comment  node-name,  next,  previous,  up
180 @section Declaring Variables
181
182 Use @code{defcustom} to declare user editable variables.
183
184 @defun defcustom symbol [keyword value]... doc
185 Declare @var{symbol} as a customizable variable that defaults to @var{value}.
186 Neither @var{symbol} nor @var{value} needs to be quoted.
187 If @var{symbol} is not already bound, initialize it to @var{value}.
188
189 @var{doc} is the variable documentation.
190
191 The following @var{keyword}'s are defined:
192
193 @table @code
194 @item :type     
195 @var{value} should be a sexp widget.
196 @item :group
197 @var{value} should be a customization group. 
198 Add @var{symbol} to that group. 
199 @end table
200
201 @xref{Sexp Types,,widget,The Widget Library}, for information about
202 widgets to use together with the @code{:type} keyword.
203 @end defun
204
205 Internally, custom uses the symbol property @code{custom-type} to keep
206 track of the variables type, @code{factory-value} for the program
207 specified default value, @code{default-value} for a user specified
208 default value, and @code{variable-documentation} for the documentation
209 string.
210
211
212 @node  Declaring Faces, The Init File, Declaring Variables, Top
213 @comment  node-name,  next,  previous,  up
214 @section Declaring Faces
215
216 Faces are declared with @code{defface}.
217
218 @defun defface FACE SPEC [KEYWORD VALUE]... DOC
219
220 Declare @var{face} as a customizable face that defaults to @var{spec}.
221 @var{face} does not need to be quoted.
222
223 If @var{face} has been set with `custom-set-face', set the face attributes
224 as specified by that function, otherwise set the face attributes
225 according to @var{spec}.
226
227 @var{doc} is the face documentation.
228
229 The following @var{keyword}'s are defined:
230
231 @table @code
232 @item :group
233 @var{value} should be a customization group. 
234 Add @var{symbol} to that group. 
235 @end table
236
237 @var{spec} should be an alist of the form @samp{((@var{display} @var{atts})...)}.
238
239 @var{atts} is a list of face attributes and their values.  The possible
240 attributes are defined in the variable `custom-face-attributes'.
241 Alternatively, @var{atts} can be a face in which case the attributes of
242 that face is used.
243
244 The @var{atts} of the first entry in @var{spec} where the @var{display}
245 matches the frame should take effect in that frame.  @var{display} can
246 either be the symbol `t', which will match all frames, or an alist of
247 the form @samp{((@var{req} @var{item}...)...)}@refill
248
249 For the @var{display} to match a FRAME, the @var{req} property of the
250 frame must match one of the @var{item}.  The following @var{req} are
251 defined:@refill
252
253 @table @code
254 @item type
255 (the value of (window-system))@br
256 Should be one of @code{x} or @code{tty}.
257
258 @item class
259 (the frame's color support)@br
260 Should be one of @code{color}, @code{grayscale}, or @code{mono}.
261
262 @item background
263 (what color is used for the background text)@br
264 Should be one of @code{light} or @code{dark}.
265 @end table
266   
267 Internally, custom uses the symbol property @code{factory-face} for the
268 program specified default face properties, @code{default-face} for a
269 user specified default properties, and @code{face-documentation} for the
270 documentation string.@refill
271
272 @end defun
273
274 @node  The Init File, Wishlist, Declaring Faces, Top
275 @comment  node-name,  next,  previous,  up
276 @section The Init File
277
278 When you save the customizations, call to @code{custom-set-variables},
279 @code{custom-set-faces} are inserted into the file specified by
280 @code{custom-file}.  By default @code{custom-file} is your @file{.emacs}
281 file.  The two functions will initialize variables and faces as you have
282 specified. 
283
284 @node  Wishlist,  , The Init File, Top
285 @comment  node-name,  next,  previous,  up
286 @section Wishlist
287
288 @itemize @bullet
289 @item
290 The names of the menu items for the @code{custom-variable},
291 @code{custom-face}, and @code{custom-group} tags should be rethought.
292 Some of the actions may be better placed as buttons in the buffer.
293
294 @item
295 The menu items above should be grayed out when the information is
296 missing.  I.e. if a variable doesn't have a factory setting, the user
297 should not be allowed to select the @samp{Factory} menu item.
298
299 @item 
300 We need @strong{much} better support for keyboard operations in the
301 customize buffer.
302
303 @item
304 There should be buttons that will apply, set, reset, etc. all the relevant
305 widgets in a customize buffer.
306
307 @item
308 There should be a menu in the customize buffer.
309
310 @item
311 The group widget should allow you to apply, set, reset, etc. all the
312 relevant members of the group.
313
314 @item
315 There should be a function to create a customize menu from a group.
316
317 @item
318 There should be a `Help | Customize' entry in the menu bar with a user
319 specified number of levels of submenus.  
320
321 @item
322 It would be nice if one could set simple variables directly from the
323 menu. 
324
325 @item
326 Support real specifiers under XEmacs.
327
328 @item
329 @code{customize-apropos} should only match user options that has either
330 been declared with this library, or variables whose documentation start
331 with @samp{*}.  With an prefix argument, also match all variables that
332 has a documentation string.
333
334 @item
335 If there is only one line of documentation, the @samp{Documentation}
336 tag-menu items should go from `first line only' to `none' without going
337 over `full'.  I.e. it should have two states instead of three.
338
339 @item
340 @code{custom-face} should display the @code{face-documentation}
341 property.
342
343 @item
344 @code{custom-face}, @code{custom-variable}, and @code{custom-group}
345 should be derived from a common @code{custom} widget.
346
347 @item
348 Integrate with @file{w3} so you can customization buffers with much
349 better formatting.  I'm thinking about adding a <custom>name</custom>
350 tag. 
351
352 @end itemize
353
354 @contents
355 @bye