diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/type-keywords.html | |
new repository
Diffstat (limited to 'devdocs/elisp/type-keywords.html')
| -rw-r--r-- | devdocs/elisp/type-keywords.html | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/devdocs/elisp/type-keywords.html b/devdocs/elisp/type-keywords.html new file mode 100644 index 00000000..56b8975c --- /dev/null +++ b/devdocs/elisp/type-keywords.html @@ -0,0 +1,26 @@ + <h4 class="subsection">Type Keywords</h4> <p>You can specify keyword-argument pairs in a customization type after the type name symbol. Here are the keywords you can use, and their meanings: </p> <dl compact> <dt><code>:value <var>default</var></code></dt> <dd> +<p>Provide a default value. </p> <p>If <code>nil</code> is not a valid value for the alternative, then it is essential to specify a valid default with <code>:value</code>. </p> <p>If you use this for a type that appears as an alternative inside of <code>choice</code>; it specifies the default value to use, at first, if and when the user selects this alternative with the menu in the customization buffer. </p> <p>Of course, if the actual value of the option fits this alternative, it will appear showing the actual value, not <var>default</var>. </p> </dd> <dt><code>:format <var>format-string</var></code></dt> <dd> + <p>This string will be inserted in the buffer to represent the value corresponding to the type. The following ‘<samp>%</samp>’ escapes are available for use in <var>format-string</var>: </p> <dl compact> <dt>‘<samp>%[<var>button</var>%]</samp>’</dt> <dd> +<p>Display the text <var>button</var> marked as a button. The <code>:action</code> attribute specifies what the button will do if the user invokes it; its value is a function which takes two arguments—the widget which the button appears in, and the event. </p> <p>There is no way to specify two different buttons with different actions. </p> </dd> <dt>‘<samp>%{<var>sample</var>%}</samp>’</dt> <dd> +<p>Show <var>sample</var> in a special face specified by <code>:sample-face</code>. </p> </dd> <dt>‘<samp>%v</samp>’</dt> <dd> +<p>Substitute the item’s value. How the value is represented depends on the kind of item, and (for variables) on the customization type. </p> </dd> <dt>‘<samp>%d</samp>’</dt> <dd> +<p>Substitute the item’s documentation string. </p> </dd> <dt>‘<samp>%h</samp>’</dt> <dd> +<p>Like ‘<samp>%d</samp>’, but if the documentation string is more than one line, add a button to control whether to show all of it or just the first line. </p> </dd> <dt>‘<samp>%t</samp>’</dt> <dd> +<p>Substitute the tag here. You specify the tag with the <code>:tag</code> keyword. </p> </dd> <dt>‘<samp>%%</samp>’</dt> <dd><p>Display a literal ‘<samp>%</samp>’. </p></dd> </dl> </dd> <dt><code>:action <var>action</var></code></dt> <dd> + <p>Perform <var>action</var> if the user clicks on a button. </p> </dd> <dt><code>:button-face <var>face</var></code></dt> <dd> + <p>Use the face <var>face</var> (a face name or a list of face names) for button text displayed with ‘<samp>%[…%]</samp>’. </p> </dd> <dt><code>:button-prefix <var>prefix</var></code></dt> <dt><code>:button-suffix <var>suffix</var></code></dt> <dd> + <p>These specify the text to display before and after a button. Each can be: </p> <dl compact> <dt><code>nil</code></dt> <dd> +<p>No text is inserted. </p> </dd> <dt>a string</dt> <dd> +<p>The string is inserted literally. </p> </dd> <dt>a symbol</dt> <dd><p>The symbol’s value is used. </p></dd> </dl> </dd> <dt><code>:tag <var>tag</var></code></dt> <dd> +<p>Use <var>tag</var> (a string) as the tag for the value (or part of the value) that corresponds to this type. </p> </dd> <dt><code>:doc <var>doc</var></code></dt> <dd> + <p>Use <var>doc</var> as the documentation string for this value (or part of the value) that corresponds to this type. In order for this to work, you must specify a value for <code>:format</code>, and use ‘<samp>%d</samp>’ or ‘<samp>%h</samp>’ in that value. </p> <p>The usual reason to specify a documentation string for a type is to provide more information about the meanings of alternatives inside a <code>choice</code> type or the parts of some other composite type. </p> </dd> <dt><code>:help-echo <var>motion-doc</var></code></dt> <dd> + <p>When you move to this item with <code>widget-forward</code> or <code>widget-backward</code>, it will display the string <var>motion-doc</var> in the echo area. In addition, <var>motion-doc</var> is used as the mouse <code>help-echo</code> string and may actually be a function or form evaluated to yield a help string. If it is a function, it is called with one argument, the widget. </p> </dd> <dt><code>:match <var>function</var></code></dt> <dd> + <p>Specify how to decide whether a value matches the type. The corresponding value, <var>function</var>, should be a function that accepts two arguments, a widget and a value; it should return non-<code>nil</code> if the value is acceptable. </p> </dd> <dt><code>:match-inline <var>function</var></code></dt> <dd> + <p>Specify how to decide whether an inline value matches the type. The corresponding value, <var>function</var>, should be a function that accepts two arguments, a widget and an inline value; it should return non-<code>nil</code> if the value is acceptable. See <a href="splicing-into-lists">Splicing into Lists</a> for more information about inline values. </p> </dd> <dt><code>:validate <var>function</var></code></dt> <dd> +<p>Specify a validation function for input. <var>function</var> takes a widget as an argument, and should return <code>nil</code> if the widget’s current value is valid for the widget. Otherwise, it should return the widget containing the invalid data, and set that widget’s <code>:error</code> property to a string explaining the error. </p> </dd> <dt><code>:type-error <var>string</var></code></dt> <dd> + <p><var>string</var> should be a string that describes why a value doesn’t match the type, as determined by the <code>:match</code> function. When the <code>:match</code> function returns <code>nil</code>, the widget’s <code>:error</code> property will be set to <var>string</var>. </p> </dd> </dl><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/Type-Keywords.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Type-Keywords.html</a> + </p> +</div> |
