annotate man/lispref/customize.texi @ 5908:6174848f3e6c

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