1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<h3 class="section">Customization Types</h3> <p>When you define a user option with <code>defcustom</code>, you must specify its <em>customization type</em>. That is a Lisp object which describes (1) which values are legitimate and (2) how to display the value in the customization buffer for editing. </p> <p>You specify the customization type in <code>defcustom</code> with the <code>:type</code> keyword. The argument of <code>:type</code> is evaluated, but only once when the <code>defcustom</code> is executed, so it isn’t useful for the value to vary. Normally we use a quoted constant. For example: </p> <div class="example"> <pre class="example">(defcustom diff-command "diff"
"The command to use to run diff."
:type '(string)
:group 'diff)
</pre>
</div> <p>In general, a customization type is a list whose first element is a symbol, one of the customization type names defined in the following sections. After this symbol come a number of arguments, depending on the symbol. Between the type symbol and its arguments, you can optionally write keyword-value pairs (see <a href="type-keywords">Type Keywords</a>). </p> <p>Some type symbols do not use any arguments; those are called <em>simple types</em>. For a simple type, if you do not use any keyword-value pairs, you can omit the parentheses around the type symbol. For example just <code>string</code> as a customization type is equivalent to <code>(string)</code>. </p> <p>All customization types are implemented as widgets; see <a href="https://www.gnu.org/software/emacs/manual/html_node/widget/index.html#Top">Introduction</a> in <cite>The Emacs Widget Library</cite>, for details. </p> <table class="menu" border="0" cellspacing="0"> <tr>
<td align="left" valign="top">• <a href="simple-types" accesskey="1">Simple Types</a>
</td>
<td> </td>
<td align="left" valign="top">Simple customization types: sexp, integer, etc. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="composite-types" accesskey="2">Composite Types</a>
</td>
<td> </td>
<td align="left" valign="top">Build new types from other types or data. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="splicing-into-lists" accesskey="3">Splicing into Lists</a>
</td>
<td> </td>
<td align="left" valign="top">Splice elements into list with <code>:inline</code>. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="type-keywords" accesskey="4">Type Keywords</a>
</td>
<td> </td>
<td align="left" valign="top">Keyword-argument pairs in a customization type. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="defining-new-types" accesskey="5">Defining New Types</a>
</td>
<td> </td>
<td align="left" valign="top">Give your type a name. </td>
</tr> </table><div class="_attribution">
<p class="_attribution-p">
Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Customization-Types.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Customization-Types.html</a>
</p>
</div>
|