annotate man/lispref/customize.texi @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents 74fd4e045ea6
children 7d972c3de90a
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::
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
19 @end menu
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
20
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
21 @node Common Keywords
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
22 @section Common Keywords for All Kinds of Items
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
23
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
24 All kinds of customization declarations (for variables and groups, and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
25 for faces) accept keyword arguments for specifying various information.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
26 This section describes some keywords that apply to all kinds.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
27
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
28 All of these keywords, except @code{:tag}, can be used more than once
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
29 in a given item. Each use of the keyword has an independent effect.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
30 The keyword @code{:tag} is an exception because any given item can only
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
31 display one name.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
32
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
33 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
34 @item :tag @var{name}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
35 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
36 in customization menus and buffers.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
37
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
38 @item :group @var{group}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
39 Put this customization item in group @var{group}. When you use
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
40 @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
41 @var{group}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
42
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
43 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
44 more than one group. Displaying any of those groups will show this
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
45 item. Be careful not to overdo this!
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
46
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
47 @item :link @var{link-data}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
48 Include an external link after the documentation string for this item.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
49 This is a sentence containing an active field which references some
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
50 other documentation.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
51
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
52 There are three alternatives you can use for @var{link-data}:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
53
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
54 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
55 @item (custom-manual @var{info-node})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
56 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
57 node name, as in @code{"(emacs)Top"}. The link appears as
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
58 @samp{[manual]} in the customization buffer.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
59
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
60 @item (info-link @var{info-node})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
61 Like @code{custom-manual} except that the link appears
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
62 in the customization buffer with the Info node name.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
63
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
64 @item (url-link @var{url})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
65 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
66 The link appears in the customization buffer as @var{url}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
67 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
68
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
69 You can specify the text to use in the customization buffer by adding
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
70 @code{:tag @var{name}} after the first element of the @var{link-data};
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
71 for example, @code{(info-link :tag "foo" "(emacs)Top")} makes a link to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
72 the Emacs manual which appears in the buffer as @samp{foo}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
73
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
74 An item can have more than one external link; however, most items have
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
75 none at all.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
76
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
77 @item :load @var{file}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
78 Load file @var{file} (a string) before displaying this customization
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
79 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
80 not already loaded.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
81
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
82 @item :require @var{feature}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
83 Require feature @var{feature} (a symbol) when installing a value for
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
84 this item (an option or a face) that was saved using the customization
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
85 feature. This is done by calling @code{require}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
86
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
87 The most common reason to use @code{:require} is when a variable enables
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
88 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
89 any effect unless the code which implements the mode is loaded.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
90 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
91
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
92 @node Group Definitions
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
93 @section Defining Custom Groups
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
94
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
95 Each Emacs Lisp package should have one main customization group which
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
96 contains all the options, faces and other groups in the package. If the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
97 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
98 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
99 faces, then you should structure them into subgroups, and put the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
100 subgroups under the package's main customization group. It is OK to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
101 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
102 the subgroups.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
103
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
104 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
105 the standard customization groups. (To display the full list of them,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
106 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
107 many), and add your group to each of them using the @code{:group}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
108 keyword.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
109
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
110 The way to declare new customization groups is with @code{defgroup}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
111
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
112 @tindex defgroup
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
113 @defmac defgroup group members doc [keyword value]...
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
114 Declare @var{group} as a customization group containing @var{members}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
115 Do not quote the symbol @var{group}. The argument @var{doc} specifies
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
116 the documentation string for the group.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
117
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
118 The argument @var{members} is a list specifying an initial set of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
119 customization items to be members of the group. However, most often
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
120 @var{members} is @code{nil}, and you specify the group's members by
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
121 using the @code{:group} keyword when defining those members.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
122
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
123 If you want to specify group members through @var{members}, each element
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
124 should have the form @code{(@var{name} @var{widget})}. Here @var{name}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
125 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
126 Useful widgets are @code{custom-variable} for a variable,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
127 @code{custom-face} for a face, and @code{custom-group} for a group.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
128
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
129 In addition to the common keywords (@pxref{Common Keywords}), you can
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
130 use this keyword in @code{defgroup}:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
131
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
132 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
133 @item :prefix @var{prefix}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
134 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
135 tag for that item is constructed (by default) by omitting @var{prefix}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
136
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
137 One group can have any number of prefixes.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
138 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
139 @end defmac
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
140
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
141 @c Doesn't apply to XEmacs
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
142 @c
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
143 @c The prefix-discarding feature is currently turned off, which means
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
144 @c that @code{:prefix} currently has no effect. We did this because we
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
145 @c found that discarding the specified prefixes often led to confusing
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
146 @c names for options. This happened because the people who wrote the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
147 @c @code{defgroup} definitions for various groups added @code{:prefix}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
148 @c keywords whenever they make logical sense---that is, whenever the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
149 @c variables in the library have a common prefix.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
150
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
151 @c In order to obtain good results with @code{:prefix}, it would be
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
152 @c necessary to check the specific effects of discarding a particular
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
153 @c prefix, given the specific items in a group and their names and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
154 @c documentation. If the resulting text is not clear, then @code{:prefix}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
155 @c should not be used in that case.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
156
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
157 @c It should be possible to recheck all the customization groups, delete
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
158 @c the @code{:prefix} specifications which give unclear results, and then
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
159 @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
160
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
161 @node Variable Definitions
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
162 @section Defining Customization Variables
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
163
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
164 Use @code{defcustom} to declare user-editable variables.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
165
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
166 @tindex defcustom
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
167 @defmac defcustom option default doc [keyword value]...
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
168 Declare @var{option} as a customizable user option variable. Do not
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
169 quote @var{option}. The argument @var{doc} specifies the documentation
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
170 string for the variable.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
171
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
172 If @var{option} is void, @code{defcustom} initializes it to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
173 @var{default}. @var{default} should be an expression to compute the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
174 value; be careful in writing it, because it can be evaluated on more
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
175 than one occasion.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
176
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
177 The following additional keywords are defined:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
178
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
179 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
180 @item :type @var{type}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
181 Use @var{type} as the data type for this option. It specifies which
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
182 values are legitimate, and how to display the value.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
183 @xref{Customization Types}, for more information.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
184
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
185 @item :options @var{list}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
186 Specify @var{list} as the list of reasonable values for use in this
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
187 option.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
188
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
189 Currently this is meaningful only when the type is @code{hook}. In that
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
190 case, the elements of @var{list} should be functions that are useful as
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
191 elements of the hook value. The user is not restricted to using only
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
192 these functions, but they are offered as convenient alternatives.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
193
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
194 @item :version @var{version}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
195 This option specifies that the variable was first introduced, or its
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
196 default value was changed, in Emacs version @var{version}. The value
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
197 @var{version} must be a string. For example,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
198
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
199 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
200 (defcustom foo-max 34
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
201 "*Maximum number of foo's allowed."
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
202 :type 'integer
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
203 :group 'foo
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
204 :version "20.3")
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
205 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
206
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
207 @item :set @var{setfunction}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
208 Specify @var{setfunction} as the way to change the value of this option.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
209 The function @var{setfunction} should take two arguments, a symbol and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
210 the new value, and should do whatever is necessary to update the value
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
211 properly for this option (which may not mean simply setting the option
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
212 as a Lisp variable). The default for @var{setfunction} is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
213 @code{set-default}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
214
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
215 @item :get @var{getfunction}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
216 Specify @var{getfunction} as the way to extract the value of this
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
217 option. The function @var{getfunction} should take one argument, a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
218 symbol, and should return the ``current value'' for that symbol (which
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
219 need not be the symbol's Lisp value). The default is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
220 @code{default-value}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
221
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
222 @item :initialize @var{function}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
223 @var{function} should be a function used to initialize the variable when
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
224 the @code{defcustom} is evaluated. It should take two arguments, the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
225 symbol and value. Here are some predefined functions meant for use in
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
226 this way:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
227
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
228 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
229 @item custom-initialize-set
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
230 Use the variable's @code{:set} function to initialize the variable, but
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
231 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
232 @code{:initialize} function.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
233
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
234 @item custom-initialize-default
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
235 Like @code{custom-initialize-set}, but use the function
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
236 @code{set-default} to set the variable, instead of the variable's
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
237 @code{:set} function. This is the usual choice for a variable whose
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
238 @code{:set} function enables or disables a minor mode; with this choice,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
239 defining the variable will not call the minor mode function, but
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
240 customizing the variable will do so.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
241
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
242 @item custom-initialize-reset
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
243 Always use the @code{:set} function to initialize the variable. If the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
244 variable is already non-void, reset it by calling the @code{:set}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
245 function using the current value (returned by the @code{:get} method).
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
246
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
247 @item custom-initialize-changed
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
248 Use the @code{:set} function to initialize the variable, if it is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
249 already set or has been customized; otherwise, just use
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
250 @code{set-default}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
251 @end table
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 defmac
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
254
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
255 The @code{:require} option is useful for an option that turns on the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
256 operation of a certain feature. Assuming that the package is coded to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
257 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
258 to be loaded. You can do that with @code{:require}. @xref{Common
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
259 Keywords}. Here is an example, from the library @file{paren.el}:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
260
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
261 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
262 (defcustom show-paren-mode nil
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
263 "Toggle Show Paren mode@enddots{}"
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
264 :set (lambda (symbol value)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 318
diff changeset
265 (show-paren-mode (or value 0)))
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
266 :initialize 'custom-initialize-default
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
267 :type 'boolean
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
268 :group 'paren-showing
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
269 :require 'paren)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
270 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
271
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
272 @ignore
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
273 Use @code{custom-add-option} to specify that a specific function is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
274 useful as an member of a hook.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
275
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
276 @defun custom-add-option symbol option
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
277 To the variable @var{symbol} add @var{option}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
278
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
279 If @var{symbol} is a hook variable, @var{option} should be a hook
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
280 member. For other types variables, the effect is undefined."
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
281 @end defun
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
282 @end ignore
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
283
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
284 Internally, @code{defcustom} uses the symbol property
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
285 @code{standard-value} to record the expression for the default value,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
286 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
287 customization buffer. The @code{saved-value} property is actually a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
288 list whose car is an expression which evaluates to the value.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
289
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
290 @node Customization Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
291 @section Customization Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
292
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
293 When you define a user option with @code{defcustom}, you must specify
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
294 its @dfn{customization type}. That is a Lisp object which describes (1)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
295 which values are legitimate and (2) how to display the value in the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
296 customization buffer for editing.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
297
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
298 You specify the customization type in @code{defcustom} with the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
299 @code{:type} keyword. The argument of @code{:type} is evaluated; since
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
300 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
301 constant. For example:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
302
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
303 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
304 (defcustom diff-command "diff"
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
305 "*The command to use to run diff."
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
306 :type '(string)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
307 :group 'diff)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
308 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
309
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
310 In general, a customization type is a list whose first element is a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
311 symbol, one of the customization type names defined in the following
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
312 sections. After this symbol come a number of arguments, depending on
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
313 the symbol. Between the type symbol and its arguments, you can
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
314 optionally write keyword-value pairs (@pxref{Type Keywords}).
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
315
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
316 Some of the type symbols do not use any arguments; those are called
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
317 @dfn{simple types}. For a simple type, if you do not use any
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
318 keyword-value pairs, you can omit the parentheses around the type
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
319 symbol. For example just @code{string} as a customization type is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
320 equivalent to @code{(string)}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
321
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
322 @menu
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
323 * Simple Types::
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
324 * Composite Types::
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
325 * Splicing into Lists::
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
326 * Type Keywords::
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
327 @end menu
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
328
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
329 @node Simple Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
330 @subsection Simple Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
331
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
332 This section describes all the simple customization 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 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
335 @item sexp
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
336 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
337 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
338 take the time to work out a more specific type to use.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
339
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
340 @item integer
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
341 The value must be an integer, and is represented textually
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
342 in the customization buffer.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
343
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
344 @item number
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
345 The value must be a number, and is represented textually in the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
346 customization buffer.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
347
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
348 @item string
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
349 The value must be a string, and the customization buffer shows just the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
350 contents, with no delimiting @samp{"} characters and no quoting with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
351 @samp{\}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
352
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
353 @item regexp
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
354 Like @code{string} except that the string must be a valid regular
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
355 expression.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
356
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
357 @item character
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
358 The value must be a character code. A character code is actually an
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
359 integer, but this type shows the value by inserting the character in the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
360 buffer, rather than by showing the number.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
361
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
362 @item file
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
363 The value must be a file name, and you can do completion with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
364 @kbd{M-@key{TAB}}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
365
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
366 @item (file :must-match t)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
367 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
368 completion with @kbd{M-@key{TAB}}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
369
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
370 @item directory
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
371 The value must be a directory name, and you can do completion with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
372 @kbd{M-@key{TAB}}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
373
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
374 @item symbol
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
375 The value must be a symbol. It appears in the customization buffer as
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
376 the name of the symbol.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
377
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
378 @item function
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
379 The value must be either a lambda expression or a function name. When
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
380 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
381
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
382 @item variable
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
383 The value must be a variable name, and you can do completion with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
384 @kbd{M-@key{TAB}}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
385
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
386 @item face
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
387 The value must be a symbol which is a face name.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
388
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
389 @item boolean
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
390 The value is boolean---either @code{nil} or @code{t}. Note that by
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
391 using @code{choice} and @code{const} together (see the next section),
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
392 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
393 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
394 meaning of the alternative.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
395 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
396
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
397 @node Composite Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
398 @subsection Composite Types
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
399
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
400 When none of the simple types is appropriate, you can use composite
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
401 types, which build new types from other types. Here are several ways of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
402 doing that:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
403
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
404 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
405 @item (restricted-sexp :match-alternatives @var{criteria})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
406 The value may be any Lisp object that satisfies one of @var{criteria}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
407 @var{criteria} should be a list, and each elements should be
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
408 one of these possibilities:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
409
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
410 @itemize @bullet
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
411 @item
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
412 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
413 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
414 are acceptable.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
415
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
416 @item
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
417 A quoted constant---that is, @code{'@var{object}}. This means that
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
418 @var{object} itself is an acceptable value.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
419 @end itemize
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
420
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
421 For example,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
422
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
423 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
424 (restricted-sexp :match-alternatives (integerp 't 'nil))
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
425 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
426
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
427 @noindent
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
428 allows integers, @code{t} and @code{nil} as legitimate values.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
429
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
430 The customization buffer shows all legitimate values using their read
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
431 syntax, and the user edits them textually.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
432
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
433 @item (cons @var{car-type} @var{cdr-type})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
434 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
435 its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
436 symbol)} is a customization type which matches values such as
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
437 @code{("foo" . foo)}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
438
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
439 In the customization buffer, the @sc{car} and the @sc{cdr} are
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
440 displayed and edited separately, each according to the type
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
441 that you specify for it.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
442
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
443 @item (list @var{element-types}@dots{})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
444 The value must be a list with exactly as many elements as the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
445 @var{element-types} you have specified; and each element must fit the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
446 corresponding @var{element-type}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
447
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
448 For example, @code{(list integer string function)} describes a list of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
449 three elements; the first element must be an integer, the second a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
450 string, and the third a function.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
451
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
452 In the customization buffer, the each element is displayed and edited
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
453 separately, according to the type specified for it.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
454
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
455 @item (vector @var{element-types}@dots{})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
456 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
457 list. The elements work the same as in @code{list}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
458
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
459 @item (choice @var{alternative-types}...)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
460 The value must fit at least one of @var{alternative-types}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
461 For example, @code{(choice integer string)} allows either an
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
462 integer or a string.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
463
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
464 In the customization buffer, the user selects one of the alternatives
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
465 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
466 alternative.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
467
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
468 Normally the strings in this menu are determined automatically from the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
469 choices; however, you can specify different strings for the menu by
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
470 including the @code{:tag} keyword in the alternatives. For example, if
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
471 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
472 verbatim, you might write the customization type this way,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
473
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
474 @smallexample
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
475 (choice (integer :tag "Number of spaces")
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
476 (string :tag "Literal text"))
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
477 @end smallexample
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
478
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
479 @noindent
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
480 so that the menu offers @samp{Number of spaces} and @samp{Literal Text}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
481
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
482 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
483 a @code{const}, you should specify a valid default for that alternative
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
484 using the @code{:value} keyword. @xref{Type Keywords}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
485
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
486 @item (const @var{value})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
487 The value must be @var{value}---nothing else is allowed.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
488
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
489 The main use of @code{const} is inside of @code{choice}. For example,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
490 @code{(choice integer (const nil))} allows either an integer or
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
491 @code{nil}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
492
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
493 @code{:tag} is often used with @code{const}, inside of @code{choice}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
494 For example,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
495
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
496 @smallexample
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
497 (choice (const :tag "Yes" t)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
498 (const :tag "No" nil)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
499 (const :tag "Ask" foo))
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
500 @end smallexample
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
501
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
502 @item (function-item @var{function})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
503 Like @code{const}, but used for values which are functions. This
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
504 displays the documentation string as well as the function name.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
505 The documentation string is either the one you specify with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
506 @code{:doc}, or @var{function}'s own documentation string.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
507
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
508 @item (variable-item @var{variable})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
509 Like @code{const}, but used for values which are variable names. This
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
510 displays the documentation string as well as the variable name. The
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
511 documentation string is either the one you specify with @code{:doc}, or
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
512 @var{variable}'s own documentation string.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
513
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
514 @item (set @var{elements}@dots{})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
515 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
516 @var{elements} specified. This appears in the customization buffer as a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
517 checklist.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
518
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
519 @item (repeat @var{element-type})
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
520 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
521 @var{element-type}. This appears in the customization buffer as a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
522 list of elements, with @samp{[INS]} and @samp{[DEL]} buttons for adding
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
523 more elements or removing elements.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
524 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
525
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
526 @node Splicing into Lists
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
527 @subsection Splicing into Lists
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
528
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
529 The @code{:inline} feature lets you splice a variable number of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
530 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
531 @code{set}, @code{choice} or @code{repeat} type which appears among the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
532 element-types of a @code{list} or @code{vector}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
533
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
534 Normally, each of the element-types in a @code{list} or @code{vector}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
535 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
536 element-type is a @code{repeat}, that specifies a list of unspecified
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
537 length which appears as one element.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
538
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
539 But when the element-type uses @code{:inline}, the value it matches is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
540 merged directly into the containing sequence. For example, if it
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
541 matches a list with three elements, those become three elements of the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
542 overall sequence. This is analogous to using @samp{,@@} in the backquote
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
543 construct.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
544
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
545 For example, to specify a list whose first element must be @code{t}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
546 and whose remaining arguments should be zero or more of @code{foo} and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
547 @code{bar}, use this customization type:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
548
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
549 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
550 (list (const t) (set :inline t foo bar))
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
551 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
552
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
553 @noindent
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
554 This matches values such as @code{(t)}, @code{(t foo)}, @code{(t bar)}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
555 and @code{(t foo bar)}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
556
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
557 When the element-type is a @code{choice}, you use @code{:inline} not
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
558 in the @code{choice} itself, but in (some of) the alternatives of the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
559 @code{choice}. For example, to match a list which must start with a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
560 file name, followed either by the symbol @code{t} or two strings, use
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
561 this customization type:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
562
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
563 @example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
564 (list file
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
565 (choice (const t)
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
566 (list :inline t string string)))
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
567 @end example
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
568
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
569 @noindent
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
570 If the user chooses the first alternative in the choice, then the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
571 overall list has two elements and the second element is @code{t}. If
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
572 the user chooses the second alternative, then the overall list has three
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
573 elements and the second and third must be strings.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
574
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
575 @node Type Keywords
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
576 @subsection Type Keywords
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
577
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
578 You can specify keyword-argument pairs in a customization type after the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
579 type name symbol. Here are the keywords you can use, and their
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
580 meanings:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
581
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
582 @table @code
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
583 @item :value @var{default}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
584 This is used for a type that appears as an alternative inside of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
585 @code{choice}; it specifies the default value to use, at first, if and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
586 when the user selects this alternative with the menu in the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
587 customization buffer.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
588
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
589 Of course, if the actual value of the option fits this alternative, it
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
590 will appear showing the actual value, not @var{default}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
591
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
592 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
593 essential to specify a valid default with @code{:value}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
594
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
595 @item :format @var{format-string}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
596 This string will be inserted in the buffer to represent the value
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
597 corresponding to the type. The following @samp{%} escapes are available
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
598 for use in @var{format-string}:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
599
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
600 @table @samp
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
601 @item %[@var{button}%]
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
602 Display the text @var{button} marked as a button. The @code{:action}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
603 attribute specifies what the button will do if the user invokes it;
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
604 its value is a function which takes two arguments---the widget which
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
605 the button appears in, and the event.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
606
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
607 There is no way to specify two different buttons with different
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
608 actions.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
609
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
610 @item %@{@var{sample}%@}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
611 Show @var{sample} in a special face specified by @code{:sample-face}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
612
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
613 @item %v
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
614 Substitute the item's value. How the value is represented depends on
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
615 the kind of item, and (for variables) on the customization type.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
616
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
617 @item %d
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
618 Substitute the item's documentation string.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
619
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
620 @item %h
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
621 Like @samp{%d}, but if the documentation string is more than one line,
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
622 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
623 first line.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
624
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
625 @item %t
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
626 Substitute the tag here. You specify the tag with the @code{:tag}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
627 keyword.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
628
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
629 @item %%
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 398
diff changeset
630 Display a literal @samp{%}.
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
631 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
632
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
633 @item :action @var{action}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
634 Perform @var{action} if the user clicks on a button.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
635
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
636 @item :button-face @var{face}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
637 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
638 text displayed with @samp{%[@dots{}%]}.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
639
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
640 @item :button-prefix @var{prefix}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
641 @itemx :button-suffix @var{suffix}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
642 These specify the text to display before and after a button.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
643 Each can be:
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
644
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
645 @table @asis
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
646 @item @code{nil}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
647 No text is inserted.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
648
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
649 @item a string
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
650 The string is inserted literally.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
651
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
652 @item a symbol
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
653 The symbol's value is used.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
654 @end table
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
655
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
656 @item :tag @var{tag}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
657 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
658 that corresponds to this type.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
659
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
660 @item :doc @var{doc}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
661 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
662 value) that corresponds to this type. In order for this to work, you
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
663 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
664 in that value.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
665
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
666 The usual reason to specify a documentation string for a type is to
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
667 provide more information about the meanings of alternatives inside a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
668 @code{:choice} type or the parts of some other composite type.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
669
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
670 @item :help-echo @var{motion-doc}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
671 When you move to this item with @code{widget-forward} or
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
672 @code{widget-backward}, it will display the string @var{motion-doc}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
673 in the echo area.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
674
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
675 @item :match @var{function}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
676 Specify how to decide whether a value matches the type. The
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
677 corresponding value, @var{function}, should be a function that accepts
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
678 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
679 the value is acceptable.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
680
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
681 @ignore
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
682 @item :indent @var{columns}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
683 Indent this item by @var{columns} columns. The indentation is used for
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
684 @samp{%n}, and automatically for group names, for checklists and radio
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
685 buttons, and for editable lists. It affects the whole of the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
686 item except for the first line.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
687
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
688 @item :offset @var{columns}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
689 An integer indicating how many extra spaces to indent the subitems of
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
690 this item. By default, subitems are indented the same as their parent.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
691
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
692 @item :extra-offset
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
693 An integer indicating how many extra spaces to add to this item's
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
694 indentation, compared to its parent.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
695
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
696 @item :notify
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
697 A function called each time the item or a subitem is changed. The
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
698 function is called with two or three arguments. The first argument is
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
699 the item itself, the second argument is the item that was changed, and
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
700 the third argument is the event leading to the change, if any.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
701
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
702 @item :menu-tag
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
703 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
704 @code{menu-choice} widget.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
705
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
706 @item :menu-tag-get
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
707 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
708 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
709 @code{:menu-tag} or @code{:tag} property if present, or the @code{princ}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
710 representation of the @code{:value} property if not.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
711
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
712 @item :validate
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 398
diff changeset
713 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
714 widgets current value is valid for the widget. Otherwise, it should
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
715 return the widget containing the invalid data, and set that widgets
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
716 @code{:error} property to a string explaining the error.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
717
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
718 You can use the function @code{widget-children-validate} for this job;
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
719 it tests that all children of @var{widget} are valid.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
720
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
721 @item :tab-order
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
722 Specify the order in which widgets are traversed with
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
723 @code{widget-forward} or @code{widget-backward}. This is only partially
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
724 implemented.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
725
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
726 @enumerate a
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
727 @item
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
728 Widgets with tabbing order @code{-1} are ignored.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
729
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 398
diff changeset
730 @item
318
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
731 (Unimplemented) When on a widget with tabbing order @var{n}, go to the
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
732 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
733 whichever comes first.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
734
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
735 @item
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
736 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
737 in the buffer with a positive tabbing order, or @code{nil}
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
738 @end enumerate
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
739
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
740 @item :parent
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
741 The parent of a nested widget (e.g. a @code{menu-choice} item or an
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
742 element of a @code{editable-list} widget).
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
743
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
744 @item :sibling-args
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
745 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
746 @code{checklist}. The value should be a list of extra keyword
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
747 arguments, which will be used when creating the @code{radio-button} or
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
748 @code{checkbox} associated with this item.
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
749 @end ignore
afd57c14dfc8 Import from CVS: tag r21-0b57
cvs
parents:
diff changeset
750 @end table