diff options
| author | Chong Yidong | 2011-07-02 20:45:24 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-07-02 20:45:24 -0400 |
| commit | 3deead93c4665e2a064f19264c90e7371de5a843 (patch) | |
| tree | 22ca7abcdd8d2566484ec21bf96a5f2d86e4a42c /doc | |
| parent | b00d8c1a00d33b1d2b0a6678e964eb41eb6fc2ae (diff) | |
| download | emacs-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/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/customize.texi | 212 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 3 |
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 @@ | |||
| 1 | 2011-07-03 Chong Yidong <cyd@stupidchicken.com> | 1 | 2011-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)}. | |||
| 513 | Introduction, widget, The Emacs Widget Library}, for details. | 513 | Introduction, 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 |
| 578 | the hook; see @ref{Variable Definitions}. | 577 | the hook; see @ref{Variable Definitions}. |
| 579 | 578 | ||
| 580 | @item alist | 579 | @item symbol |
| 581 | The value must be a list of cons-cells, the @sc{car} of each cell | 580 | The value must be a symbol. It appears in the customization buffer as |
| 582 | representing a key, and the @sc{cdr} of the same cell representing an | 581 | the name of the symbol. |
| 583 | associated value. The user can add and delete key/value pairs, and | ||
| 584 | edit both the key and the value of each pair. | ||
| 585 | 582 | ||
| 586 | You can specify the key and value types like this: | 583 | @item function |
| 584 | The value must be either a lambda expression or a function name. When | ||
| 585 | it 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}) | 588 | The value must be a variable name, and you can do completion with |
| 590 | @end smallexample | 589 | @kbd{M-@key{TAB}}. |
| 590 | |||
| 591 | @item face | ||
| 592 | The value must be a symbol which is a face name, and you can do | ||
| 593 | completion with @kbd{M-@key{TAB}}. | ||
| 594 | |||
| 595 | @item boolean | ||
| 596 | The value is boolean---either @code{nil} or @code{t}. Note that by | ||
| 597 | using @code{choice} and @code{const} together (see the next section), | ||
| 598 | you can specify that the value must be @code{nil} or @code{t}, but also | ||
| 599 | specify the text to describe each value in a way that fits the specific | ||
| 600 | meaning of the alternative. | ||
| 601 | |||
| 602 | @item coding-system | ||
| 603 | The value must be a coding-system name, and you can do completion with | ||
| 604 | @kbd{M-@key{TAB}}. | ||
| 605 | |||
| 606 | @item color | ||
| 607 | The 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 | ||
| 616 | types, which build new types from other types or from specified data. | ||
| 617 | The specified types or data are called the @dfn{arguments} of the | ||
| 618 | composite 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 |
| 593 | where @var{key-type} and @var{value-type} are customization type | 625 | but you can also add keyword-value pairs before the arguments, like |
| 594 | specifications. The default key type is @code{sexp}, and the default | 626 | this: |
| 595 | value 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 | ||
| 633 | composite types: | ||
| 634 | |||
| 635 | @table @code | ||
| 636 | @item (cons @var{car-type} @var{cdr-type}) | ||
| 637 | The value must be a cons cell, its @sc{car} must fit @var{car-type}, and | ||
| 638 | its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string | ||
| 639 | symbol)} is a customization type which matches values such as | ||
| 640 | @code{("foo" . foo)}. | ||
| 641 | |||
| 642 | In the customization buffer, the @sc{car} and the @sc{cdr} are | ||
| 643 | displayed and edited separately, each according to the type | ||
| 644 | that you specify for it. | ||
| 645 | |||
| 646 | @item (list @var{element-types}@dots{}) | ||
| 647 | The value must be a list with exactly as many elements as the | ||
| 648 | @var{element-types} given; and each element must fit the | ||
| 649 | corresponding @var{element-type}. | ||
| 650 | |||
| 651 | For example, @code{(list integer string function)} describes a list of | ||
| 652 | three elements; the first element must be an integer, the second a | ||
| 653 | string, and the third a function. | ||
| 654 | |||
| 655 | In the customization buffer, each element is displayed and edited | ||
| 656 | separately, according to the type specified for it. | ||
| 657 | |||
| 658 | @item (group @var{element-types}@dots{}) | ||
| 659 | This works like @code{list} except for the formatting | ||
| 660 | of text in the Custom buffer. @code{list} labels each | ||
| 661 | element value with its tag; @code{group} does not. | ||
| 662 | |||
| 663 | @item (vector @var{element-types}@dots{}) | ||
| 664 | Like @code{list} except that the value must be a vector instead of a | ||
| 665 | list. The elements work the same as in @code{list}. | ||
| 666 | |||
| 667 | @item (alist :key-type @var{key-type} :value-type @var{value-type}) | ||
| 668 | The value must be a list of cons-cells, the @sc{car} of each cell | ||
| 669 | representing 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 | ||
| 672 | edit both the key and the value of each pair. | ||
| 673 | |||
| 674 | If omitted, @var{key-type} and @var{value-type} default to | ||
| 675 | @code{sexp}. | ||
| 596 | 676 | ||
| 597 | The user can add any key matching the specified key type, but you can | 677 | The user can add any key matching the specified key type, but you can |
| 598 | give some keys a preferential treatment by specifying them with the | 678 | give 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}) |
| 691 | The @code{plist} custom type is similar to the @code{alist} (see above), | 771 | This customization type is similar to @code{alist} (see above), except |
| 692 | except that the information is stored as a property list, i.e. a list of | 772 | that (i) the information is stored as a property list, |
| 693 | this form: | 773 | (@pxref{Property Lists}), and (ii) @var{key-type}, if omitted, |
| 694 | 774 | defaults 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 | |||
| 699 | The default @code{:key-type} for @code{plist} is @code{symbol}, | ||
| 700 | rather than @code{sexp}. | ||
| 701 | |||
| 702 | @item symbol | ||
| 703 | The value must be a symbol. It appears in the customization buffer as | ||
| 704 | the name of the symbol. | ||
| 705 | |||
| 706 | @item function | ||
| 707 | The value must be either a lambda expression or a function name. When | ||
| 708 | it is a function name, you can do completion with @kbd{M-@key{TAB}}. | ||
| 709 | |||
| 710 | @item variable | ||
| 711 | The value must be a variable name, and you can do completion with | ||
| 712 | @kbd{M-@key{TAB}}. | ||
| 713 | |||
| 714 | @item face | ||
| 715 | The value must be a symbol which is a face name, and you can do | ||
| 716 | completion with @kbd{M-@key{TAB}}. | ||
| 717 | |||
| 718 | @item boolean | ||
| 719 | The value is boolean---either @code{nil} or @code{t}. Note that by | ||
| 720 | using @code{choice} and @code{const} together (see the next section), | ||
| 721 | you can specify that the value must be @code{nil} or @code{t}, but also | ||
| 722 | specify the text to describe each value in a way that fits the specific | ||
| 723 | meaning of the alternative. | ||
| 724 | |||
| 725 | @item coding-system | ||
| 726 | The value must be a coding-system name, and you can do completion with | ||
| 727 | @kbd{M-@key{TAB}}. | ||
| 728 | |||
| 729 | @item color | ||
| 730 | The 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 | ||
| 739 | types, which build new types from other types or from specified data. | ||
| 740 | The specified types or data are called the @dfn{arguments} of the | ||
| 741 | composite type. The composite type normally looks like this: | ||
| 742 | |||
| 743 | @example | ||
| 744 | (@var{constructor} @var{arguments}@dots{}) | ||
| 745 | @end example | ||
| 746 | |||
| 747 | @noindent | ||
| 748 | but you can also add keyword-value pairs before the arguments, like | ||
| 749 | this: | ||
| 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 | ||
| 756 | composite types: | ||
| 757 | |||
| 758 | @table @code | ||
| 759 | @item (cons @var{car-type} @var{cdr-type}) | ||
| 760 | The value must be a cons cell, its @sc{car} must fit @var{car-type}, and | ||
| 761 | its @sc{cdr} must fit @var{cdr-type}. For example, @code{(cons string | ||
| 762 | symbol)} is a customization type which matches values such as | ||
| 763 | @code{("foo" . foo)}. | ||
| 764 | |||
| 765 | In the customization buffer, the @sc{car} and the @sc{cdr} are | ||
| 766 | displayed and edited separately, each according to the type | ||
| 767 | that you specify for it. | ||
| 768 | |||
| 769 | @item (list @var{element-types}@dots{}) | ||
| 770 | The value must be a list with exactly as many elements as the | ||
| 771 | @var{element-types} given; and each element must fit the | ||
| 772 | corresponding @var{element-type}. | ||
| 773 | |||
| 774 | For example, @code{(list integer string function)} describes a list of | ||
| 775 | three elements; the first element must be an integer, the second a | ||
| 776 | string, and the third a function. | ||
| 777 | |||
| 778 | In the customization buffer, each element is displayed and edited | ||
| 779 | separately, according to the type specified for it. | ||
| 780 | |||
| 781 | @item (group @var{element-types}@dots{}) | ||
| 782 | This works like @code{list} except for the formatting | ||
| 783 | of text in the Custom buffer. @code{list} labels each | ||
| 784 | element value with its tag; @code{group} does not. | ||
| 785 | |||
| 786 | @item (vector @var{element-types}@dots{}) | ||
| 787 | Like @code{list} except that the value must be a vector instead of a | ||
| 788 | list. 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{}) |
| 791 | The value must fit at least one of @var{alternative-types}. | 777 | The 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 | ||
| 506 | Customization Types | 506 | Customization 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. |