aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-07-23 19:19:32 +0000
committerRichard M. Stallman2002-07-23 19:19:32 +0000
commit608dc4173fde54c1441b1d8762550deb72dcf761 (patch)
treed8244e3a0a3903b3aa1ceff3f51385e6698174a9
parent9e7638c33d5a6de64971af50a8fdfe3e80d03709 (diff)
downloademacs-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.texi93
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
583types, which build new types from other types. Here are several ways of 584types, which build new types from other types or from specified data.
584doing that: 585The specified types or data are called the @dfn{arguments} of the
585 586composite type. The composite type normally looks like this:
586@table @code
587@item (restricted-sexp :match-alternatives @var{criteria})
588The value may be any Lisp object that satisfies one of @var{criteria}.
589@var{criteria} should be a list, and each element should be
590one of these possibilities:
591
592@itemize @bullet
593@item
594A predicate---that is, a function of one argument that has no side
595effects, and returns either @code{nil} or non-@code{nil} according to
596the argument. Using a predicate in the list says that objects for which
597the predicate returns non-@code{nil} are acceptable.
598
599@item
600A quoted constant---that is, @code{'@var{object}}. This sort of element
601in the list says that @var{object} itself is an acceptable value.
602@end itemize
603
604For 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
612allows integers, @code{t} and @code{nil} as legitimate values. 593but you can also add keyword-value pairs before the arguments, like
594this:
613 595
614The customization buffer shows all legitimate values using their read 596@example
615syntax, 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
601composite types:
602
603@table @code
617@item (cons @var{car-type} @var{cdr-type}) 604@item (cons @var{car-type} @var{cdr-type})
618The value must be a cons cell, its @sc{car} must fit @var{car-type}, and 605The value must be a cons cell, its @sc{car} must fit @var{car-type}, and
619its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string 606its @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
762list of elements, with @samp{[INS]} and @samp{[DEL]} buttons for adding 749list of elements, with @samp{[INS]} and @samp{[DEL]} buttons for adding
763more elements or removing elements. 750more elements or removing elements.
751
752@item (restricted-sexp :match-alternatives @var{criteria})
753This is the most general composite type construct. The value may be
754any Lisp object that satisfies one of @var{criteria}. @var{criteria}
755should be a list, and each element should be one of these
756possibilities:
757
758@itemize @bullet
759@item
760A predicate---that is, a function of one argument that has no side
761effects, and returns either @code{nil} or non-@code{nil} according to
762the argument. Using a predicate in the list says that objects for which
763the predicate returns non-@code{nil} are acceptable.
764
765@item
766A quoted constant---that is, @code{'@var{object}}. This sort of element
767in the list says that @var{object} itself is an acceptable value.
768@end itemize
769
770For example,
771
772@example
773(restricted-sexp :match-alternatives
774 (integerp 't 'nil))
775@end example
776
777@noindent
778allows integers, @code{t} and @code{nil} as legitimate values.
779
780The customization buffer shows all legitimate values using their read
781syntax, 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
785in a composite type:
786
787@table @code
788@item :tag @var{tag}
789Use @var{tag} as the name of this alternative, for user communication
790purposes. This is useful for a type that appears inside of a
791@code{choice}.
792
793@item :match-alternatives @var{criteria}
794Use @var{criteria} to match possible values. This is used only in
795@code{restricted-sexp}.
796
797@item :args @var{argumentlist}
798Use the elements of @var{argumentlist} as the arguments of the type
799construct. For instance, @code{(const :args (foo))} is equivalent to
800@code{(const foo)}. You rarely need to write @code{:args} explicitly,
801because normally the arguments are recognized automatically as
802whatever follows the last keyword-value pair.
764@end table 803@end table
765 804
766@node Splicing into Lists 805@node Splicing into Lists