aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorChong Yidong2011-07-02 20:45:24 -0400
committerChong Yidong2011-07-02 20:45:24 -0400
commit3deead93c4665e2a064f19264c90e7371de5a843 (patch)
tree22ca7abcdd8d2566484ec21bf96a5f2d86e4a42c /doc
parentb00d8c1a00d33b1d2b0a6678e964eb41eb6fc2ae (diff)
downloademacs-3deead93c4665e2a064f19264c90e7371de5a843.tar.gz
emacs-3deead93c4665e2a064f19264c90e7371de5a843.zip
* customize.texi (Composite Types): Move alist/plist from Simple Types (Bug#7545).
* elisp.texi (Top): Update menu description.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/customize.texi212
-rw-r--r--doc/lispref/elisp.texi3
3 files changed, 105 insertions, 115 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 2a17a57f90f..1b89cefb271 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,5 +1,10 @@
12011-07-03 Chong Yidong <cyd@stupidchicken.com> 12011-07-03 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * customize.texi (Composite Types): Move alist and plist to here
4 from Simple Types (Bug#7545).
5
6 * elisp.texi (Top): Update menu description.
7
3 * display.texi (Face Attributes): Document negative line widths 8 * display.texi (Face Attributes): Document negative line widths
4 (Bug#6113). 9 (Bug#6113).
5 10
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi
index 8ce523dda2e..52d8fa42389 100644
--- a/doc/lispref/customize.texi
+++ b/doc/lispref/customize.texi
@@ -513,8 +513,7 @@ equivalent to @code{(string)}.
513Introduction, widget, The Emacs Widget Library}, for details. 513Introduction, widget, The Emacs Widget Library}, for details.
514 514
515@menu 515@menu
516* Simple Types:: Simple customization types: sexp, integer, number, 516* Simple Types:: Simple customization types: sexp, integer, etc.
517 string, file, directory, alist.
518* Composite Types:: Build new types from other types or data. 517* Composite Types:: Build new types from other types or data.
519* Splicing into Lists:: Splice elements into list with @code{:inline}. 518* Splicing into Lists:: Splice elements into list with @code{:inline}.
520* Type Keywords:: Keyword-argument pairs in a customization type. 519* Type Keywords:: Keyword-argument pairs in a customization type.
@@ -577,22 +576,103 @@ You can use the @code{:options} keyword in a hook variable's
577@code{defcustom} to specify a list of functions recommended for use in 576@code{defcustom} to specify a list of functions recommended for use in
578the hook; see @ref{Variable Definitions}. 577the hook; see @ref{Variable Definitions}.
579 578
580@item alist 579@item symbol
581The value must be a list of cons-cells, the @sc{car} of each cell 580The value must be a symbol. It appears in the customization buffer as
582representing a key, and the @sc{cdr} of the same cell representing an 581the name of the symbol.
583associated value. The user can add and delete key/value pairs, and
584edit both the key and the value of each pair.
585 582
586You can specify the key and value types like this: 583@item function
584The value must be either a lambda expression or a function name. When
585it is a function name, you can do completion with @kbd{M-@key{TAB}}.
587 586
588@smallexample 587@item variable
589(alist :key-type @var{key-type} :value-type @var{value-type}) 588The value must be a variable name, and you can do completion with
590@end smallexample 589@kbd{M-@key{TAB}}.
590
591@item face
592The value must be a symbol which is a face name, and you can do
593completion with @kbd{M-@key{TAB}}.
594
595@item boolean
596The value is boolean---either @code{nil} or @code{t}. Note that by
597using @code{choice} and @code{const} together (see the next section),
598you can specify that the value must be @code{nil} or @code{t}, but also
599specify the text to describe each value in a way that fits the specific
600meaning of the alternative.
601
602@item coding-system
603The value must be a coding-system name, and you can do completion with
604@kbd{M-@key{TAB}}.
605
606@item color
607The value must be a valid color name, and you can do completion with
608@kbd{M-@key{TAB}}. A sample is provided.
609@end table
610
611@node Composite Types
612@subsection Composite Types
613@cindex composite types (customization)
614
615 When none of the simple types is appropriate, you can use composite
616types, which build new types from other types or from specified data.
617The specified types or data are called the @dfn{arguments} of the
618composite type. The composite type normally looks like this:
619
620@example
621(@var{constructor} @var{arguments}@dots{})
622@end example
591 623
592@noindent 624@noindent
593where @var{key-type} and @var{value-type} are customization type 625but you can also add keyword-value pairs before the arguments, like
594specifications. The default key type is @code{sexp}, and the default 626this:
595value type is @code{sexp}. 627
628@example
629(@var{constructor} @r{@{}@var{keyword} @var{value}@r{@}}@dots{} @var{arguments}@dots{})
630@end example
631
632 Here is a table of constructors and how to use them to write
633composite types:
634
635@table @code
636@item (cons @var{car-type} @var{cdr-type})
637The value must be a cons cell, its @sc{car} must fit @var{car-type}, and
638its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string
639symbol)} is a customization type which matches values such as
640@code{("foo" . foo)}.
641
642In the customization buffer, the @sc{car} and the @sc{cdr} are
643displayed and edited separately, each according to the type
644that you specify for it.
645
646@item (list @var{element-types}@dots{})
647The value must be a list with exactly as many elements as the
648@var{element-types} given; and each element must fit the
649corresponding @var{element-type}.
650
651For example, @code{(list integer string function)} describes a list of
652three elements; the first element must be an integer, the second a
653string, and the third a function.
654
655In the customization buffer, each element is displayed and edited
656separately, according to the type specified for it.
657
658@item (group @var{element-types}@dots{})
659This works like @code{list} except for the formatting
660of text in the Custom buffer. @code{list} labels each
661element value with its tag; @code{group} does not.
662
663@item (vector @var{element-types}@dots{})
664Like @code{list} except that the value must be a vector instead of a
665list. The elements work the same as in @code{list}.
666
667@item (alist :key-type @var{key-type} :value-type @var{value-type})
668The value must be a list of cons-cells, the @sc{car} of each cell
669representing a key of customization type @var{key-type}, and the
670@sc{cdr} of the same cell representing a value of customization type
671@var{value-type}. The user can add and delete key/value pairs, and
672edit both the key and the value of each pair.
673
674If omitted, @var{key-type} and @var{value-type} default to
675@code{sexp}.
596 676
597The user can add any key matching the specified key type, but you can 677The user can add any key matching the specified key type, but you can
598give some keys a preferential treatment by specifying them with the 678give some keys a preferential treatment by specifying them with the
@@ -687,105 +767,11 @@ and the VALUE is a list of that person's pets."
687 :type '(alist :value-type (repeat string))) 767 :type '(alist :value-type (repeat string)))
688@end smallexample 768@end smallexample
689 769
690@item plist 770@item (plist :key-type @var{key-type} :value-type @var{value-type})
691The @code{plist} custom type is similar to the @code{alist} (see above), 771This customization type is similar to @code{alist} (see above), except
692except that the information is stored as a property list, i.e. a list of 772that (i) the information is stored as a property list,
693this form: 773(@pxref{Property Lists}), and (ii) @var{key-type}, if omitted,
694 774defaults to @code{symbol} rather than @code{sexp}.
695@smallexample
696(@var{key} @var{value} @var{key} @var{value} @var{key} @var{value} @dots{})
697@end smallexample
698
699The default @code{:key-type} for @code{plist} is @code{symbol},
700rather than @code{sexp}.
701
702@item symbol
703The value must be a symbol. It appears in the customization buffer as
704the name of the symbol.
705
706@item function
707The value must be either a lambda expression or a function name. When
708it is a function name, you can do completion with @kbd{M-@key{TAB}}.
709
710@item variable
711The value must be a variable name, and you can do completion with
712@kbd{M-@key{TAB}}.
713
714@item face
715The value must be a symbol which is a face name, and you can do
716completion with @kbd{M-@key{TAB}}.
717
718@item boolean
719The value is boolean---either @code{nil} or @code{t}. Note that by
720using @code{choice} and @code{const} together (see the next section),
721you can specify that the value must be @code{nil} or @code{t}, but also
722specify the text to describe each value in a way that fits the specific
723meaning of the alternative.
724
725@item coding-system
726The value must be a coding-system name, and you can do completion with
727@kbd{M-@key{TAB}}.
728
729@item color
730The value must be a valid color name, and you can do completion with
731@kbd{M-@key{TAB}}. A sample is provided.
732@end table
733
734@node Composite Types
735@subsection Composite Types
736@cindex composite types (customization)
737
738 When none of the simple types is appropriate, you can use composite
739types, which build new types from other types or from specified data.
740The specified types or data are called the @dfn{arguments} of the
741composite type. The composite type normally looks like this:
742
743@example
744(@var{constructor} @var{arguments}@dots{})
745@end example
746
747@noindent
748but you can also add keyword-value pairs before the arguments, like
749this:
750
751@example
752(@var{constructor} @r{@{}@var{keyword} @var{value}@r{@}}@dots{} @var{arguments}@dots{})
753@end example
754
755 Here is a table of constructors and how to use them to write
756composite types:
757
758@table @code
759@item (cons @var{car-type} @var{cdr-type})
760The value must be a cons cell, its @sc{car} must fit @var{car-type}, and
761its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string
762symbol)} is a customization type which matches values such as
763@code{("foo" . foo)}.
764
765In the customization buffer, the @sc{car} and the @sc{cdr} are
766displayed and edited separately, each according to the type
767that you specify for it.
768
769@item (list @var{element-types}@dots{})
770The value must be a list with exactly as many elements as the
771@var{element-types} given; and each element must fit the
772corresponding @var{element-type}.
773
774For example, @code{(list integer string function)} describes a list of
775three elements; the first element must be an integer, the second a
776string, and the third a function.
777
778In the customization buffer, each element is displayed and edited
779separately, according to the type specified for it.
780
781@item (group @var{element-types}@dots{})
782This works like @code{list} except for the formatting
783of text in the Custom buffer. @code{list} labels each
784element value with its tag; @code{group} does not.
785
786@item (vector @var{element-types}@dots{})
787Like @code{list} except that the value must be a vector instead of a
788list. The elements work the same as in @code{list}.
789 775
790@item (choice @var{alternative-types}@dots{}) 776@item (choice @var{alternative-types}@dots{})
791The value must fit at least one of @var{alternative-types}. 777The value must fit at least one of @var{alternative-types}.
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index b140a1343dc..d0297032f03 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -505,8 +505,7 @@ Writing Customization Definitions
505 505
506Customization Types 506Customization Types
507 507
508* Simple Types:: Simple customization types: sexp, integer, number, 508* Simple Types:: Simple customization types: sexp, integer, etc.
509 string, file, directory, alist.
510* Composite Types:: Build new types from other types or data. 509* Composite Types:: Build new types from other types or data.
511* Splicing into Lists:: Splice elements into list with @code{:inline}. 510* Splicing into Lists:: Splice elements into list with @code{:inline}.
512* Type Keywords:: Keyword-argument pairs in a customization type. 511* Type Keywords:: Keyword-argument pairs in a customization type.