diff options
| author | Richard M. Stallman | 2002-07-23 19:19:32 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-07-23 19:19:32 +0000 |
| commit | 608dc4173fde54c1441b1d8762550deb72dcf761 (patch) | |
| tree | d8244e3a0a3903b3aa1ceff3f51385e6698174a9 | |
| parent | 9e7638c33d5a6de64971af50a8fdfe3e80d03709 (diff) | |
| download | emacs-608dc4173fde54c1441b1d8762550deb72dcf761.tar.gz emacs-608dc4173fde54c1441b1d8762550deb72dcf761.zip | |
(Composite Types): Explain what arguments are. Show what keyword-value
pairs look like. Give list of keywords. Put restricted-sexp last.
| -rw-r--r-- | lispref/customize.texi | 93 |
1 files changed, 66 insertions, 27 deletions
diff --git a/lispref/customize.texi b/lispref/customize.texi index 1a5ba157789..c755847152a 100644 --- a/lispref/customize.texi +++ b/lispref/customize.texi | |||
| @@ -578,42 +578,29 @@ The value must be a valid color name, and you can do completion with | |||
| 578 | 578 | ||
| 579 | @node Composite Types | 579 | @node Composite Types |
| 580 | @subsection Composite Types | 580 | @subsection Composite Types |
| 581 | @cindex arguments (of composite type) | ||
| 581 | 582 | ||
| 582 | When none of the simple types is appropriate, you can use composite | 583 | When none of the simple types is appropriate, you can use composite |
| 583 | types, which build new types from other types. Here are several ways of | 584 | types, which build new types from other types or from specified data. |
| 584 | doing that: | 585 | The specified types or data are called the @dfn{arguments} of the |
| 585 | 586 | composite type. The composite type normally looks like this: | |
| 586 | @table @code | ||
| 587 | @item (restricted-sexp :match-alternatives @var{criteria}) | ||
| 588 | The value may be any Lisp object that satisfies one of @var{criteria}. | ||
| 589 | @var{criteria} should be a list, and each element should be | ||
| 590 | one of these possibilities: | ||
| 591 | |||
| 592 | @itemize @bullet | ||
| 593 | @item | ||
| 594 | A predicate---that is, a function of one argument that has no side | ||
| 595 | effects, and returns either @code{nil} or non-@code{nil} according to | ||
| 596 | the argument. Using a predicate in the list says that objects for which | ||
| 597 | the predicate returns non-@code{nil} are acceptable. | ||
| 598 | |||
| 599 | @item | ||
| 600 | A quoted constant---that is, @code{'@var{object}}. This sort of element | ||
| 601 | in the list says that @var{object} itself is an acceptable value. | ||
| 602 | @end itemize | ||
| 603 | |||
| 604 | For example, | ||
| 605 | 587 | ||
| 606 | @example | 588 | @example |
| 607 | (restricted-sexp :match-alternatives | 589 | (@var{constructor} @var{arguments}@dots{}) |
| 608 | (integerp 't 'nil)) | ||
| 609 | @end example | 590 | @end example |
| 610 | 591 | ||
| 611 | @noindent | 592 | @noindent |
| 612 | allows integers, @code{t} and @code{nil} as legitimate values. | 593 | but you can also add keyword-value pairs before the arguments, like |
| 594 | this: | ||
| 613 | 595 | ||
| 614 | The customization buffer shows all legitimate values using their read | 596 | @example |
| 615 | syntax, and the user edits them textually. | 597 | (@var{constructor} @r{@{}@var{keyword} @var{value}@r{@}}@dots{} @var{arguments}@dots{}) |
| 598 | @end example | ||
| 616 | 599 | ||
| 600 | Here is a table of constructors and how to use them to write | ||
| 601 | composite types: | ||
| 602 | |||
| 603 | @table @code | ||
| 617 | @item (cons @var{car-type} @var{cdr-type}) | 604 | @item (cons @var{car-type} @var{cdr-type}) |
| 618 | The value must be a cons cell, its @sc{car} must fit @var{car-type}, and | 605 | The value must be a cons cell, its @sc{car} must fit @var{car-type}, and |
| 619 | its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string | 606 | its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string |
| @@ -761,6 +748,58 @@ The value must be a list and each element of the list must fit the type | |||
| 761 | @var{element-type}. This appears in the customization buffer as a | 748 | @var{element-type}. This appears in the customization buffer as a |
| 762 | list of elements, with @samp{[INS]} and @samp{[DEL]} buttons for adding | 749 | list of elements, with @samp{[INS]} and @samp{[DEL]} buttons for adding |
| 763 | more elements or removing elements. | 750 | more elements or removing elements. |
| 751 | |||
| 752 | @item (restricted-sexp :match-alternatives @var{criteria}) | ||
| 753 | This is the most general composite type construct. The value may be | ||
| 754 | any Lisp object that satisfies one of @var{criteria}. @var{criteria} | ||
| 755 | should be a list, and each element should be one of these | ||
| 756 | possibilities: | ||
| 757 | |||
| 758 | @itemize @bullet | ||
| 759 | @item | ||
| 760 | A predicate---that is, a function of one argument that has no side | ||
| 761 | effects, and returns either @code{nil} or non-@code{nil} according to | ||
| 762 | the argument. Using a predicate in the list says that objects for which | ||
| 763 | the predicate returns non-@code{nil} are acceptable. | ||
| 764 | |||
| 765 | @item | ||
| 766 | A quoted constant---that is, @code{'@var{object}}. This sort of element | ||
| 767 | in the list says that @var{object} itself is an acceptable value. | ||
| 768 | @end itemize | ||
| 769 | |||
| 770 | For example, | ||
| 771 | |||
| 772 | @example | ||
| 773 | (restricted-sexp :match-alternatives | ||
| 774 | (integerp 't 'nil)) | ||
| 775 | @end example | ||
| 776 | |||
| 777 | @noindent | ||
| 778 | allows integers, @code{t} and @code{nil} as legitimate values. | ||
| 779 | |||
| 780 | The customization buffer shows all legitimate values using their read | ||
| 781 | syntax, and the user edits them textually. | ||
| 782 | @end table | ||
| 783 | |||
| 784 | Here is a table of the keywords you can use in keyword-value pairs | ||
| 785 | in a composite type: | ||
| 786 | |||
| 787 | @table @code | ||
| 788 | @item :tag @var{tag} | ||
| 789 | Use @var{tag} as the name of this alternative, for user communication | ||
| 790 | purposes. This is useful for a type that appears inside of a | ||
| 791 | @code{choice}. | ||
| 792 | |||
| 793 | @item :match-alternatives @var{criteria} | ||
| 794 | Use @var{criteria} to match possible values. This is used only in | ||
| 795 | @code{restricted-sexp}. | ||
| 796 | |||
| 797 | @item :args @var{argumentlist} | ||
| 798 | Use the elements of @var{argumentlist} as the arguments of the type | ||
| 799 | construct. For instance, @code{(const :args (foo))} is equivalent to | ||
| 800 | @code{(const foo)}. You rarely need to write @code{:args} explicitly, | ||
| 801 | because normally the arguments are recognized automatically as | ||
| 802 | whatever follows the last keyword-value pair. | ||
| 764 | @end table | 803 | @end table |
| 765 | 804 | ||
| 766 | @node Splicing into Lists | 805 | @node Splicing into Lists |