annotate man/lispref/customize.texi @ 778:2923009caf47

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