annotate man/lispref/customize.texi @ 4575:eecd28508f4a

Add #'subr-arity, API taken from GNU, implementation our own. lisp/ChangeLog addition: 2009-01-11 Aidan Kehoe <kehoea@parhasard.net> * subr.el: Correct a comment, we now have #'syntax-after in syntax.el. (subr-arity): New. Docstring and API taken initially from GNU's data.c, revision 1.275, GPLv2. tests/ChangeLog addition: 2009-01-11 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el (): Test #'subr-arity, recently added to subr.el.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 11 Jan 2009 13:18:42 +0000
parents eed841acc858
children 4f0a1f4cc111
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
1 @c -*-texinfo-*-
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
2 @c This is part of the XEmacs Lisp Reference Manual.
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 398
diff changeset
3 @c Copyright (C) 1997, 1998 Free Software Foundation, Inc.
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
4 @c See the file lispref.texi for copying conditions.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
5 @setfilename ../info/customize
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
6 @node Customization, , , Top
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
7 @chapter Writing Customization Definitions
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
8
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
9 This chapter describes how to declare user options for customization,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
10 and also customization groups for classifying them. We use the term
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
11 @dfn{customization item} to include both kinds of customization
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
12 definitions---as well as face definitions.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
13
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
14 @menu
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
15 * Common Keywords::
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 398
diff changeset
16 * Group Definitions::
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 398
diff changeset
17 * Variable Definitions::
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
18 * Customization Types::
775
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
19 * Enabling Behavior::
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
20 @end menu
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
21
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
22 @node Common Keywords
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
23 @section Common Keywords for All Kinds of Items
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
24
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
25 All kinds of customization declarations (for variables and groups, and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
26 for faces) accept keyword arguments for specifying various information.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
27 This section describes some keywords that apply to all kinds.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
28
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
29 All of these keywords, except @code{:tag}, can be used more than once
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
30 in a given item. Each use of the keyword has an independent effect.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
31 The keyword @code{:tag} is an exception because any given item can only
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
32 display one name.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
33
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
34 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
35 @item :tag @var{name}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
36 Use @var{name}, a string, instead of the item's name, to label the item
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
37 in customization menus and buffers.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
38
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
39 @item :group @var{group}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
40 Put this customization item in group @var{group}. When you use
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
41 @code{:group} in a @code{defgroup}, it makes the new group a subgroup of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
42 @var{group}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
43
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
44 If you use this keyword more than once, you can put a single item into
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
45 more than one group. Displaying any of those groups will show this
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
46 item. Be careful not to overdo this!
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
47
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
48 @item :link @var{link-data}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
49 Include an external link after the documentation string for this item.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
50 This is a sentence containing an active field which references some
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
51 other documentation.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
52
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
53 There are three alternatives you can use for @var{link-data}:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
54
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
55 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
56 @item (custom-manual @var{info-node})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
57 Link to an Info node; @var{info-node} is a string which specifies the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
58 node name, as in @code{"(emacs)Top"}. The link appears as
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
59 @samp{[manual]} in the customization buffer.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
60
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
61 @item (info-link @var{info-node})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
62 Like @code{custom-manual} except that the link appears
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
63 in the customization buffer with the Info node name.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
64
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
65 @item (url-link @var{url})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
66 Link to a web page; @var{url} is a string which specifies the @sc{url}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
67 The link appears in the customization buffer as @var{url}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
68 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
69
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
70 You can specify the text to use in the customization buffer by adding
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
71 @code{:tag @var{name}} after the first element of the @var{link-data};
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
72 for example, @code{(info-link :tag "foo" "(emacs)Top")} makes a link to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
73 the Emacs manual which appears in the buffer as @samp{foo}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
74
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
75 An item can have more than one external link; however, most items have
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
76 none at all.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
77
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
78 @item :load @var{file}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
79 Load file @var{file} (a string) before displaying this customization
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
80 item. Loading is done with @code{load-library}, and only if the file is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
81 not already loaded.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
82
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
83 @item :require @var{feature}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
84 Require feature @var{feature} (a symbol) when installing a value for
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
85 this item (an option or a face) that was saved using the customization
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
86 feature. This is done by calling @code{require}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
87
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
88 The most common reason to use @code{:require} is when a variable enables
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
89 a feature such as a minor mode, and just setting the variable won't have
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
90 any effect unless the code which implements the mode is loaded.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
91 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
92
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
93 @node Group Definitions
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
94 @section Defining Custom Groups
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
95
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
96 Each Emacs Lisp package should have one main customization group which
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
97 contains all the options, faces and other groups in the package. If the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
98 package has a small number of options and faces, use just one group and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
99 put everything in it. When there are more than twelve or so options and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
100 faces, then you should structure them into subgroups, and put the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
101 subgroups under the package's main customization group. It is OK to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
102 put some of the options and faces in the package's main group alongside
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
103 the subgroups.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
104
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
105 The package's main or only group should be a member of one or more of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
106 the standard customization groups. (To display the full list of them,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
107 use @kbd{M-x customize}.) Choose one or more of them (but not too
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
108 many), and add your group to each of them using the @code{:group}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
109 keyword.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
110
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
111 The way to declare new customization groups is with @code{defgroup}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
112
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
113 @tindex defgroup
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
114 @defmac defgroup group members doc [keyword value]...
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
115 Declare @var{group} as a customization group containing @var{members}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
116 Do not quote the symbol @var{group}. The argument @var{doc} specifies
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
117 the documentation string for the group.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
118
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
119 The argument @var{members} is a list specifying an initial set of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
120 customization items to be members of the group. However, most often
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
121 @var{members} is @code{nil}, and you specify the group's members by
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
122 using the @code{:group} keyword when defining those members.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
123
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
124 If you want to specify group members through @var{members}, each element
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
125 should have the form @code{(@var{name} @var{widget})}. Here @var{name}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
126 is a symbol, and @var{widget} is a widget type for editing that symbol.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
127 Useful widgets are @code{custom-variable} for a variable,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
128 @code{custom-face} for a face, and @code{custom-group} for a group.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
129
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
130 In addition to the common keywords (@pxref{Common Keywords}), you can
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
131 use this keyword in @code{defgroup}:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
132
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
133 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
134 @item :prefix @var{prefix}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
135 If the name of an item in the group starts with @var{prefix}, then the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
136 tag for that item is constructed (by default) by omitting @var{prefix}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
137
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
138 One group can have any number of prefixes.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
139 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
140 @end defmac
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
141
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
142 @c Doesn't apply to XEmacs
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
143 @c
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
144 @c The prefix-discarding feature is currently turned off, which means
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
145 @c that @code{:prefix} currently has no effect. We did this because we
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
146 @c found that discarding the specified prefixes often led to confusing
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
147 @c names for options. This happened because the people who wrote the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
148 @c @code{defgroup} definitions for various groups added @code{:prefix}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
149 @c keywords whenever they make logical sense---that is, whenever the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
150 @c variables in the library have a common prefix.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
151
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
152 @c In order to obtain good results with @code{:prefix}, it would be
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
153 @c necessary to check the specific effects of discarding a particular
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
154 @c prefix, given the specific items in a group and their names and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
155 @c documentation. If the resulting text is not clear, then @code{:prefix}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
156 @c should not be used in that case.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
157
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
158 @c It should be possible to recheck all the customization groups, delete
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
159 @c the @code{:prefix} specifications which give unclear results, and then
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
160 @c turn this feature back on, if someone would like to do the work.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
161
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
162 @node Variable Definitions
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
163 @section Defining Customization Variables
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
164
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
165 Use @code{defcustom} to declare user-editable variables.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
166
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
167 @tindex defcustom
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
168 @defmac defcustom option default doc [keyword value]...
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
169 Declare @var{option} as a customizable user option variable. Do not
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
170 quote @var{option}. The argument @var{doc} specifies the documentation
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
171 string for the variable.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
172
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
173 If @var{option} is void, @code{defcustom} initializes it to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
174 @var{default}. @var{default} should be an expression to compute the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
175 value; be careful in writing it, because it can be evaluated on more
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
176 than one occasion.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
177
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
178 The following additional keywords are defined:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
179
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
180 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
181 @item :type @var{type}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
182 Use @var{type} as the data type for this option. It specifies which
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
183 values are legitimate, and how to display the value.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
184 @xref{Customization Types}, for more information.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
185
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
186 @item :options @var{list}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
187 Specify @var{list} as the list of reasonable values for use in this
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
188 option.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
189
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
190 Currently this is meaningful only when the type is @code{hook}. In that
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
191 case, the elements of @var{list} should be functions that are useful as
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
192 elements of the hook value. The user is not restricted to using only
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
193 these functions, but they are offered as convenient alternatives.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
194
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
195 @item :version @var{version}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
196 This option specifies that the variable was first introduced, or its
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
197 default value was changed, in Emacs version @var{version}. The value
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
198 @var{version} must be a string. For example,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
199
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
200 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
201 (defcustom foo-max 34
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
202 "*Maximum number of foo's allowed."
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
203 :type 'integer
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
204 :group 'foo
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
205 :version "20.3")
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
206 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
207
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
208 @item :set @var{setfunction}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
209 Specify @var{setfunction} as the way to change the value of this option.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
210 The function @var{setfunction} should take two arguments, a symbol and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
211 the new value, and should do whatever is necessary to update the value
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
212 properly for this option (which may not mean simply setting the option
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
213 as a Lisp variable). The default for @var{setfunction} is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
214 @code{set-default}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
215
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
216 @item :get @var{getfunction}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
217 Specify @var{getfunction} as the way to extract the value of this
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
218 option. The function @var{getfunction} should take one argument, a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
219 symbol, and should return the ``current value'' for that symbol (which
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
220 need not be the symbol's Lisp value). The default is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
221 @code{default-value}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
222
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
223 @item :initialize @var{function}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
224 @var{function} should be a function used to initialize the variable when
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
225 the @code{defcustom} is evaluated. It should take two arguments, the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
226 symbol and value. Here are some predefined functions meant for use in
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
227 this way:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
228
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
229 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
230 @item custom-initialize-set
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
231 Use the variable's @code{:set} function to initialize the variable, but
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
232 do not reinitialize it if it is already non-void. This is the default
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
233 @code{:initialize} function.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
234
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
235 @item custom-initialize-default
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
236 Like @code{custom-initialize-set}, but use the function
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
237 @code{set-default} to set the variable, instead of the variable's
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
238 @code{:set} function. This is the usual choice for a variable whose
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
239 @code{:set} function enables or disables a minor mode; with this choice,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
240 defining the variable will not call the minor mode function, but
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
241 customizing the variable will do so.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
242
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
243 @item custom-initialize-reset
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
244 Always use the @code{:set} function to initialize the variable. If the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
245 variable is already non-void, reset it by calling the @code{:set}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
246 function using the current value (returned by the @code{:get} method).
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
247
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
248 @item custom-initialize-changed
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
249 Use the @code{:set} function to initialize the variable, if it is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
250 already set or has been customized; otherwise, just use
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
251 @code{set-default}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
252 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
253 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
254 @end defmac
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
255
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
256 The @code{:require} option is useful for an option that turns on the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
257 operation of a certain feature. Assuming that the package is coded to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
258 check the value of the option, you still need to arrange for the package
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
259 to be loaded. You can do that with @code{:require}. @xref{Common
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
260 Keywords}. Here is an example, from the library @file{paren.el}:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
261
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
262 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
263 (defcustom show-paren-mode nil
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
264 "Toggle Show Paren mode@enddots{}"
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
265 :set (lambda (symbol value)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 318
diff changeset
266 (show-paren-mode (or value 0)))
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
267 :initialize 'custom-initialize-default
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
268 :type 'boolean
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
269 :group 'paren-showing
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
270 :require 'paren)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
271 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
272
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
273 @ignore
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
274 Use @code{custom-add-option} to specify that a specific function is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
275 useful as an member of a hook.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
276
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
277 @defun custom-add-option symbol option
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
278 To the variable @var{symbol} add @var{option}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
279
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
280 If @var{symbol} is a hook variable, @var{option} should be a hook
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
281 member. For other types variables, the effect is undefined."
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
282 @end defun
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
283 @end ignore
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
284
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
285 Internally, @code{defcustom} uses the symbol property
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
286 @code{standard-value} to record the expression for the default value,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
287 and @code{saved-value} to record the value saved by the user with the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
288 customization buffer. The @code{saved-value} property is actually a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
289 list whose car is an expression which evaluates to the value.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
290
775
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
291 @node Customization Types, Enabling Behavior, Variable Definitions, Customization
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
292 @section Customization Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
293
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
294 When you define a user option with @code{defcustom}, you must specify
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
295 its @dfn{customization type}. That is a Lisp object which describes (1)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
296 which values are legitimate and (2) how to display the value in the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
297 customization buffer for editing.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
298
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
299 You specify the customization type in @code{defcustom} with the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
300 @code{:type} keyword. The argument of @code{:type} is evaluated; since
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
301 types that vary at run time are rarely useful, normally you use a quoted
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
302 constant. For example:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
303
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
304 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
305 (defcustom diff-command "diff"
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
306 "*The command to use to run diff."
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
307 :type '(string)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
308 :group 'diff)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
309 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
310
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
311 In general, a customization type is a list whose first element is a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
312 symbol, one of the customization type names defined in the following
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
313 sections. After this symbol come a number of arguments, depending on
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
314 the symbol. Between the type symbol and its arguments, you can
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
315 optionally write keyword-value pairs (@pxref{Type Keywords}).
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
316
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
317 Some of the type symbols do not use any arguments; those are called
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
318 @dfn{simple types}. For a simple type, if you do not use any
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
319 keyword-value pairs, you can omit the parentheses around the type
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
320 symbol. For example just @code{string} as a customization type is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
321 equivalent to @code{(string)}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
322
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
323 @menu
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
324 * Simple Types::
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
325 * Composite Types::
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
326 * Splicing into Lists::
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
327 * Type Keywords::
1833
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
328 * Defining New Types::
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
329 @end menu
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
330
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
331 @node Simple Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
332 @subsection Simple Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
333
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
334 This section describes all the simple customization types.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
335
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
336 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
337 @item sexp
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
338 The value may be any Lisp object that can be printed and read back. You
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
339 can use @code{sexp} as a fall-back for any option, if you don't want to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
340 take the time to work out a more specific type to use.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
341
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
342 @item integer
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
343 The value must be an integer, and is represented textually
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
344 in the customization buffer.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
345
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
346 @item number
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
347 The value must be a number, and is represented textually in the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
348 customization buffer.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
349
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
350 @item string
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
351 The value must be a string, and the customization buffer shows just the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
352 contents, with no delimiting @samp{"} characters and no quoting with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
353 @samp{\}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
354
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
355 @item regexp
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
356 Like @code{string} except that the string must be a valid regular
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
357 expression.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
358
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
359 @item character
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
360 The value must be a character code. A character code is actually an
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
361 integer, but this type shows the value by inserting the character in the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
362 buffer, rather than by showing the number.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
363
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
364 @item file
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
365 The value must be a file name, and you can do completion with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
366 @kbd{M-@key{TAB}}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
367
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
368 @item (file :must-match t)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
369 The value must be a file name for an existing file, and you can do
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
370 completion with @kbd{M-@key{TAB}}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
371
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
372 @item directory
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
373 The value must be a directory name, and you can do completion with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
374 @kbd{M-@key{TAB}}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
375
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
376 @item symbol
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
377 The value must be a symbol. It appears in the customization buffer as
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
378 the name of the symbol.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
379
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
380 @item function
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
381 The value must be either a lambda expression or a function name. When
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
382 it is a function name, you can do completion with @kbd{M-@key{TAB}}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
383
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
384 @item variable
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
385 The value must be a variable name, and you can do completion with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
386 @kbd{M-@key{TAB}}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
387
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
388 @item face
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
389 The value must be a symbol which is a face name.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
390
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
391 @item boolean
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
392 The value is boolean---either @code{nil} or @code{t}. Note that by
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
393 using @code{choice} and @code{const} together (see the next section),
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
394 you can specify that the value must be @code{nil} or @code{t}, but also
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
395 specify the text to describe each value in a way that fits the specific
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
396 meaning of the alternative.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
397 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
398
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
399 @node Composite Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
400 @subsection Composite Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
401
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
402 When none of the simple types is appropriate, you can use composite
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
403 types, which build new types from other types. Here are several ways of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
404 doing that:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
405
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
406 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
407 @item (restricted-sexp :match-alternatives @var{criteria})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
408 The value may be any Lisp object that satisfies one of @var{criteria}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
409 @var{criteria} should be a list, and each elements should be
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
410 one of these possibilities:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
411
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
412 @itemize @bullet
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
413 @item
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
414 A predicate---that is, a function of one argument that returns non-@code{nil}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
415 if the argument fits a certain type. This means that objects of that type
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
416 are acceptable.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
417
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
418 @item
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
419 A quoted constant---that is, @code{'@var{object}}. This means that
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
420 @var{object} itself is an acceptable value.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
421 @end itemize
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
422
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
423 For example,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
424
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
425 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
426 (restricted-sexp :match-alternatives (integerp 't 'nil))
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
427 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
428
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
429 @noindent
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
430 allows integers, @code{t} and @code{nil} as legitimate values.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
431
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
432 The customization buffer shows all legitimate values using their read
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
433 syntax, and the user edits them textually.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
434
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
435 @item (cons @var{car-type} @var{cdr-type})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
436 The value must be a cons cell, its @sc{car} must fit @var{car-type}, and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
437 its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
438 symbol)} is a customization type which matches values such as
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
439 @code{("foo" . foo)}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
440
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
441 In the customization buffer, the @sc{car} and the @sc{cdr} are
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
442 displayed and edited separately, each according to the type
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
443 that you specify for it.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
444
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
445 @item (list @var{element-types}@dots{})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
446 The value must be a list with exactly as many elements as the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
447 @var{element-types} you have specified; and each element must fit the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
448 corresponding @var{element-type}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
449
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
450 For example, @code{(list integer string function)} describes a list of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
451 three elements; the first element must be an integer, the second a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
452 string, and the third a function.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
453
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
454 In the customization buffer, the each element is displayed and edited
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
455 separately, according to the type specified for it.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
456
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
457 @item (vector @var{element-types}@dots{})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
458 Like @code{list} except that the value must be a vector instead of a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
459 list. The elements work the same as in @code{list}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
460
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
461 @item (choice @var{alternative-types}...)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
462 The value must fit at least one of @var{alternative-types}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
463 For example, @code{(choice integer string)} allows either an
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
464 integer or a string.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
465
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
466 In the customization buffer, the user selects one of the alternatives
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
467 using a menu, and can then edit the value in the usual way for that
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
468 alternative.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
469
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
470 Normally the strings in this menu are determined automatically from the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
471 choices; however, you can specify different strings for the menu by
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
472 including the @code{:tag} keyword in the alternatives. For example, if
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
473 an integer stands for a number of spaces, while a string is text to use
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
474 verbatim, you might write the customization type this way,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
475
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
476 @smallexample
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
477 (choice (integer :tag "Number of spaces")
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
478 (string :tag "Literal text"))
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
479 @end smallexample
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
480
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
481 @noindent
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
482 so that the menu offers @samp{Number of spaces} and @samp{Literal Text}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
483
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
484 In any alternative for which @code{nil} is not a valid value, other than
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
485 a @code{const}, you should specify a valid default for that alternative
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
486 using the @code{:value} keyword. @xref{Type Keywords}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
487
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
488 @item (const @var{value})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
489 The value must be @var{value}---nothing else is allowed.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
490
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
491 The main use of @code{const} is inside of @code{choice}. For example,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
492 @code{(choice integer (const nil))} allows either an integer or
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
493 @code{nil}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
494
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
495 @code{:tag} is often used with @code{const}, inside of @code{choice}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
496 For example,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
497
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
498 @smallexample
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
499 (choice (const :tag "Yes" t)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
500 (const :tag "No" nil)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
501 (const :tag "Ask" foo))
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
502 @end smallexample
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
503
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
504 @item (function-item @var{function})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
505 Like @code{const}, but used for values which are functions. This
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
506 displays the documentation string as well as the function name.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
507 The documentation string is either the one you specify with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
508 @code{:doc}, or @var{function}'s own documentation string.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
509
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
510 @item (variable-item @var{variable})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
511 Like @code{const}, but used for values which are variable names. This
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
512 displays the documentation string as well as the variable name. The
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
513 documentation string is either the one you specify with @code{:doc}, or
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
514 @var{variable}'s own documentation string.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
515
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
516 @item (set @var{elements}@dots{})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
517 The value must be a list and each element of the list must be one of the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
518 @var{elements} specified. This appears in the customization buffer as a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
519 checklist.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
520
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
521 @item (repeat @var{element-type})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
522 The value must be a list and each element of the list must fit the type
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
523 @var{element-type}. This appears in the customization buffer as a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
524 list of elements, with @samp{[INS]} and @samp{[DEL]} buttons for adding
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
525 more elements or removing elements.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
526 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
527
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
528 @node Splicing into Lists
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
529 @subsection Splicing into Lists
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
530
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
531 The @code{:inline} feature lets you splice a variable number of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
532 elements into the middle of a list or vector. You use it in a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
533 @code{set}, @code{choice} or @code{repeat} type which appears among the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
534 element-types of a @code{list} or @code{vector}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
535
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
536 Normally, each of the element-types in a @code{list} or @code{vector}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
537 describes one and only one element of the list or vector. Thus, if an
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
538 element-type is a @code{repeat}, that specifies a list of unspecified
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
539 length which appears as one element.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
540
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
541 But when the element-type uses @code{:inline}, the value it matches is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
542 merged directly into the containing sequence. For example, if it
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
543 matches a list with three elements, those become three elements of the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
544 overall sequence. This is analogous to using @samp{,@@} in the backquote
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
545 construct.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
546
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
547 For example, to specify a list whose first element must be @code{t}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
548 and whose remaining arguments should be zero or more of @code{foo} and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
549 @code{bar}, use this customization type:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
550
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
551 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
552 (list (const t) (set :inline t foo bar))
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
553 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
554
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
555 @noindent
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
556 This matches values such as @code{(t)}, @code{(t foo)}, @code{(t bar)}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
557 and @code{(t foo bar)}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
558
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
559 When the element-type is a @code{choice}, you use @code{:inline} not
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
560 in the @code{choice} itself, but in (some of) the alternatives of the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
561 @code{choice}. For example, to match a list which must start with a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
562 file name, followed either by the symbol @code{t} or two strings, use
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
563 this customization type:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
564
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
565 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
566 (list file
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
567 (choice (const t)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
568 (list :inline t string string)))
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
569 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
570
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
571 @noindent
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
572 If the user chooses the first alternative in the choice, then the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
573 overall list has two elements and the second element is @code{t}. If
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
574 the user chooses the second alternative, then the overall list has three
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
575 elements and the second and third must be strings.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
576
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
577 @node Type Keywords
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
578 @subsection Type Keywords
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
579
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
580 You can specify keyword-argument pairs in a customization type after the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
581 type name symbol. Here are the keywords you can use, and their
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
582 meanings:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
583
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
584 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
585 @item :value @var{default}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
586 This is used for a type that appears as an alternative inside of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
587 @code{choice}; it specifies the default value to use, at first, if and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
588 when the user selects this alternative with the menu in the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
589 customization buffer.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
590
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
591 Of course, if the actual value of the option fits this alternative, it
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
592 will appear showing the actual value, not @var{default}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
593
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
594 If @code{nil} is not a valid value for the alternative, then it is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
595 essential to specify a valid default with @code{:value}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
596
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
597 @item :format @var{format-string}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
598 This string will be inserted in the buffer to represent the value
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
599 corresponding to the type. The following @samp{%} escapes are available
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
600 for use in @var{format-string}:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
601
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
602 @table @samp
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
603 @item %[@var{button}%]
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
604 Display the text @var{button} marked as a button. The @code{:action}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
605 attribute specifies what the button will do if the user invokes it;
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
606 its value is a function which takes two arguments---the widget which
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
607 the button appears in, and the event.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
608
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
609 There is no way to specify two different buttons with different
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
610 actions.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
611
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
612 @item %@{@var{sample}%@}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
613 Show @var{sample} in a special face specified by @code{:sample-face}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
614
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
615 @item %v
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
616 Substitute the item's value. How the value is represented depends on
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
617 the kind of item, and (for variables) on the customization type.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
618
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
619 @item %d
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
620 Substitute the item's documentation string.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
621
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
622 @item %h
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
623 Like @samp{%d}, but if the documentation string is more than one line,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
624 add an active field to control whether to show all of it or just the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
625 first line.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
626
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
627 @item %t
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
628 Substitute the tag here. You specify the tag with the @code{:tag}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
629 keyword.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
630
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
631 @item %%
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 398
diff changeset
632 Display a literal @samp{%}.
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
633 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
634
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
635 @item :action @var{action}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
636 Perform @var{action} if the user clicks on a button.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
637
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
638 @item :button-face @var{face}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
639 Use the face @var{face} (a face name or a list of face names) for button
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
640 text displayed with @samp{%[@dots{}%]}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
641
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
642 @item :button-prefix @var{prefix}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
643 @itemx :button-suffix @var{suffix}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
644 These specify the text to display before and after a button.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
645 Each can be:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
646
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
647 @table @asis
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
648 @item @code{nil}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
649 No text is inserted.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
650
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
651 @item a string
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
652 The string is inserted literally.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
653
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
654 @item a symbol
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
655 The symbol's value is used.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
656 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
657
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
658 @item :tag @var{tag}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
659 Use @var{tag} (a string) as the tag for the value (or part of the value)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
660 that corresponds to this type.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
661
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
662 @item :doc @var{doc}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
663 Use @var{doc} as the documentation string for this value (or part of the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
664 value) that corresponds to this type. In order for this to work, you
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
665 must specify a value for @code{:format}, and use @samp{%d} or @samp{%h}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
666 in that value.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
667
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
668 The usual reason to specify a documentation string for a type is to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
669 provide more information about the meanings of alternatives inside a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
670 @code{:choice} type or the parts of some other composite type.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
671
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
672 @item :help-echo @var{motion-doc}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
673 When you move to this item with @code{widget-forward} or
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
674 @code{widget-backward}, it will display the string @var{motion-doc}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
675 in the echo area.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
676
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
677 @item :match @var{function}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
678 Specify how to decide whether a value matches the type. The
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
679 corresponding value, @var{function}, should be a function that accepts
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
680 two arguments, a widget and a value; it should return non-@code{nil} if
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
681 the value is acceptable.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
682
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
683 @ignore
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
684 @item :indent @var{columns}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
685 Indent this item by @var{columns} columns. The indentation is used for
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
686 @samp{%n}, and automatically for group names, for checklists and radio
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
687 buttons, and for editable lists. It affects the whole of the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
688 item except for the first line.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
689
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
690 @item :offset @var{columns}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
691 An integer indicating how many extra spaces to indent the subitems of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
692 this item. By default, subitems are indented the same as their parent.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
693
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
694 @item :extra-offset
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
695 An integer indicating how many extra spaces to add to this item's
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
696 indentation, compared to its parent.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
697
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
698 @item :notify
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
699 A function called each time the item or a subitem is changed. The
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
700 function is called with two or three arguments. The first argument is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
701 the item itself, the second argument is the item that was changed, and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
702 the third argument is the event leading to the change, if any.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
703
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
704 @item :menu-tag
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
705 Tag used in the menu when the widget is used as an option in a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
706 @code{menu-choice} widget.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
707
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
708 @item :menu-tag-get
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
709 Function used for finding the tag when the widget is used as an option
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
710 in a @code{menu-choice} widget. By default, the tag used will be either the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
711 @code{:menu-tag} or @code{:tag} property if present, or the @code{princ}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
712 representation of the @code{:value} property if not.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
713
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
714 @item :validate
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 398
diff changeset
715 A function which takes a widget as an argument, and returns @code{nil} if the
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
716 widgets current value is valid for the widget. Otherwise, it should
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
717 return the widget containing the invalid data, and set that widgets
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
718 @code{:error} property to a string explaining the error.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
719
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
720 You can use the function @code{widget-children-validate} for this job;
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
721 it tests that all children of @var{widget} are valid.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
722
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
723 @item :tab-order
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
724 Specify the order in which widgets are traversed with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
725 @code{widget-forward} or @code{widget-backward}. This is only partially
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
726 implemented.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
727
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
728 @enumerate a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
729 @item
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
730 Widgets with tabbing order @code{-1} are ignored.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
731
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 398
diff changeset
732 @item
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
733 (Unimplemented) When on a widget with tabbing order @var{n}, go to the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
734 next widget in the buffer with tabbing order @var{n+1} or @code{nil},
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
735 whichever comes first.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
736
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
737 @item
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
738 When on a widget with no tabbing order specified, go to the next widget
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
739 in the buffer with a positive tabbing order, or @code{nil}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
740 @end enumerate
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
741
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
742 @item :parent
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
743 The parent of a nested widget (e.g. a @code{menu-choice} item or an
904
47c30044fc4e [xemacs-hg @ 2002-07-06 18:56:24 by adrian]
adrian
parents: 775
diff changeset
744 element of an @code{editable-list} widget).
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
745
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
746 @item :sibling-args
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
747 This keyword is only used for members of a @code{radio-button-choice} or
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
748 @code{checklist}. The value should be a list of extra keyword
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
749 arguments, which will be used when creating the @code{radio-button} or
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
750 @code{checkbox} associated with this item.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
751 @end ignore
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
752 @end table
775
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
753
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
754
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
755 @node Enabling Behavior, , Customization Types, Customization
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
756 @subsection Enabling Behavior
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
757 @cindex behavior
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
758
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
759 @c #### Does this belong here?
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
760
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
761 Some functionality requires a fair amount of effort to enable globally
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
762 in a session. For example, someone who discovers filladapt and really
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
763 likes it must toggle it separately in each buffer. On the other hand,
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
764 after trying it for a while she might like to disable it everywhere,
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
765 having decided it doesn't work very well for her. Such a functionality
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
766 is called a @dfn{behavior}.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
767
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
768 @code{define-behavior} allows the programmer to register functions to
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
769 enable or disable a package globally in a session. The user sees a
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
770 consistent interface through the @code{enable-behavior} and
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
771 @code{disable-behavior} functions. These functions were introduced in
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
772 XEmacs 21.5.6.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
773
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
774 @defvar behavior-hash-table
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
775
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
776 Internal table of registered behaviors.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
777 @end defvar
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
778
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
779 @defvar behavior-history
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
780
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
781 History of entered behaviors.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
782 @end defvar
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
783
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
784 @defun define-behavior name doc-string [cl-keys ...]
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
785
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
786 Define a behavior named @var{name}.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
787
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
788 @var{doc-string} must be specified. It is a description of what the
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
789 behavior does when it's enabled and how to further control it (typically
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
790 through custom variables). Accepted keywords are
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
791
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
792 @table @code
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
793 @item :title
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
794 A "pretty" version of the name, for use in menus. If omitted
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
795 a prettified name will be generated.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
796
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
797 @item :require
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
798 A single symbol or a list of such symbols, which need to be
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
799 present at enable time, or will be loaded using @code{require}.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
800
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
801 @item :enable
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
802 A function of no variables, which turns the behavior on.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
803
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
804 @item :disable
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
805 A function of no variables, which turns the behavior off.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
806 @end table
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
807
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
808 Behaviors are assumed to be global, and to take effect immediately; if
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
809 the underlying package is per-buffer, the enabler may have to scan all
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
810 existing buffers and frob them. When a behavior is disabled, it should
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
811 completely go away @strong{everywhere}, as if it were never invoked at
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
812 all.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
813
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
814 The @code{:disable} keyword can be missing. This is bad practice. In
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
815 such a case, attempting to disable the behavior will signal an error
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
816 unless you use the @code{force} option.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
817 @end defun
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
818
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
819 @defun read-behavior prompt [require-match [initial-contents [history [default]]]]
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
820
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
821 Return a behavior symbol from the minibuffer, prompting with string
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
822 @var{prompt}.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
823
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
824 The optional arguments @var{require-match}, @var{initial-contents},
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
825 @var{history}, and @var{default} are passed to @code{completing-read},
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
826 and have semantics derived from that function. @ref{Minibuffer
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
827 Completion}. The default value of @var{history} is
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
828 @code{behavior-history}.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
829 @end defun
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
830
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
831 @defun behavior-enabled-p name
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
832
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
833 Return non-nil if the behavior registered under @var{name} is enabled.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
834
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
835 Unimplemented in 21.5.6.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
836 @end defun
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
837
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
838 @defun enable-behavior behavior [force]
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
839 Enable the behavior registered under the symbol @var{behavior}.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
840
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
841 The optional argument @var{force} is unimplemented in 21.5.6.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
842
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
843 Called interactively, prompt the user for @var{behavior}, and take
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
844 @var{force} from the prefix argument.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
845 @end defun
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
846
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
847 @defun disable-behavior (behavior &optional force)
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
848 Disable the behavior registered under the symbol @var{behavior}.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
849
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
850 The optional argument @var{force} is unimplemented in 21.5.6.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
851
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
852 Called interactively, prompt the user for @var{behavior}, and take
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
853 @var{force} from the prefix argument.
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
854 @end defun
7d972c3de90a [xemacs-hg @ 2002-03-14 11:50:12 by stephent]
stephent
parents: 444
diff changeset
855
1833
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
856 @node Defining New Types
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
857 @subsection Defining New Types
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
858
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
859 In the previous sections we have described how to construct elaborate
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
860 type specifications for @code{defcustom}. In some cases you may want to
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
861 give such a type specification a name. The obvious case is when you are
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
862 using the same type for many user options, rather than repeat the
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
863 specification for each option, you can give the type specification a
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
864 name once, and use that name each @code{defcustom}. The other case is
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
865 when a user option accept a recursive datastructure. To make it
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
866 possible for a datatype to refer to itself, it needs to have a name.
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
867
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
868 Since custom types are implemented as widgets, the way to define a new
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
869 customize type is to define a new widget. We are not going to describe
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
870 the widget interface here in details, see @ref{Top, , Introduction,
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
871 widget, The Emacs Widget Library}, for that. Instead we are going to
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
872 demonstrate the minimal functionality needed for defining new customize
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
873 types by a simple example.
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
874
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
875 @example
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
876 (define-widget 'binary-tree-of-string 'lazy
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
877 "A binary tree made of cons-cells and strings."
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
878 :offset 4
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
879 :tag "Node"
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
880 :type '(choice (string :tag "Leaf" :value "")
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
881 (cons :tag "Interior"
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
882 :value ("" . "")
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
883 binary-tree-of-string
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
884 binary-tree-of-string)))
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
885
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
886 (defcustom foo-bar ""
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
887 "Sample variable holding a binary tree of strings."
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
888 :type 'binary-tree-of-string)
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
889 @end example
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
890
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
891 The function to define a new widget is name @code{define-widget}. The
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
892 first argument is the symbol we want to make a new widget type. The
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
893 second argument is a symbol representing an existing widget, the new
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
894 widget is going to be defined in terms of difference from the existing
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
895 widget. For the purpose of defining new customization types, the
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
896 @code{lazy} widget is perfect, because it accept a @code{:type} keyword
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
897 argument with the same syntax as the keyword argument to
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
898 @code{defcustom} with the same name. The third argument is a
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
899 documentation string for the new widget. You will be able to see that
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
900 string with the @kbd{M-x widget-browse @key{ret} binary-tree-of-string
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
901 @key{ret}} command.
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
902
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
903 After these mandatory arguments follows the keyword arguments. The most
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
904 important is @code{:type}, which describes the datatype we want to match
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
905 with this widget. Here a @code{binary-tree-of-string} is described as
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
906 being either a string, or a cons-cell whose car and cdr are themselves
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
907 both @code{binary-tree-of-string}. Note the reference to the widget
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
908 type we are currently in the process of defining. The @code{:tag}
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
909 attribute is a string to name the widget in the user interface, and the
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
910 @code{:offset} argument are there to ensure that child nodes are
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
911 indented four spaces relatively to the parent node, making the tree
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
912 structure apparent in the customization buffer.
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
913
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
914 The @code{defcustom} shows how the new widget can be used as an ordinary
eed841acc858 [xemacs-hg @ 2003-12-19 14:28:45 by youngs]
youngs
parents: 904
diff changeset
915 customization type.