diff options
| -rw-r--r-- | doc/lispref/ChangeLog | 7 | ||||
| -rw-r--r-- | doc/lispref/minibuf.texi | 87 |
2 files changed, 80 insertions, 14 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 86f0a91a33f..afd6700ef61 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | 2012-04-06 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * minibuf.texi (Programmed Completion): Document metadata method. | ||
| 4 | (Completion Variables): Document completion-category-overrides. | ||
| 5 | |||
| 1 | 2012-04-05 Chong Yidong <cyd@gnu.org> | 6 | 2012-04-05 Chong Yidong <cyd@gnu.org> |
| 2 | 7 | ||
| 3 | * anti.texi (Antinews): Rewrite for Emacs 23. | 8 | * anti.texi (Antinews): Rewrite for Emacs 23. |
| 4 | 9 | ||
| 5 | * minibuf.texi (Programmed Completion): Document metadata method. | ||
| 6 | |||
| 7 | 2012-04-04 Chong Yidong <cyd@gnu.org> | 10 | 2012-04-04 Chong Yidong <cyd@gnu.org> |
| 8 | 11 | ||
| 9 | * minibuf.texi (Programmed Completion): Remove obsolete variable | 12 | * minibuf.texi (Programmed Completion): Remove obsolete variable |
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 8e1bd4bf5ee..4e11bc30d49 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi | |||
| @@ -1575,12 +1575,10 @@ completion behavior. | |||
| 1575 | 1575 | ||
| 1576 | @cindex completion styles | 1576 | @cindex completion styles |
| 1577 | @defopt completion-styles | 1577 | @defopt completion-styles |
| 1578 | The value of this variable is a list of completion styles to use for | 1578 | The value of this variable is a list of completion style (symbols) to |
| 1579 | performing completion. A @dfn{completion style} is a set of rules for | 1579 | use for performing completion. A @dfn{completion style} is a set of |
| 1580 | generating completions. | 1580 | rules for generating completions. Each symbol in occurring this list |
| 1581 | 1581 | must have a corresponding entry in @code{completion-styles-alist}. | |
| 1582 | Each style listed in this variable must be one of those defined in | ||
| 1583 | @code{completion-styles-alist}. | ||
| 1584 | @end defopt | 1582 | @end defopt |
| 1585 | 1583 | ||
| 1586 | @defvar completion-styles-alist | 1584 | @defvar completion-styles-alist |
| @@ -1588,15 +1586,16 @@ This variable stores a list of available completion styles. Each | |||
| 1588 | element in the list has the form | 1586 | element in the list has the form |
| 1589 | 1587 | ||
| 1590 | @example | 1588 | @example |
| 1591 | (@var{name} @var{try-completion} @var{all-completions} @var{doc}) | 1589 | (@var{style} @var{try-completion} @var{all-completions} @var{doc}) |
| 1592 | @end example | 1590 | @end example |
| 1593 | 1591 | ||
| 1594 | @noindent | 1592 | @noindent |
| 1595 | Here, @var{name} is the name of the completion style (a symbol), which | 1593 | Here, @var{style} is the name of the completion style (a symbol), |
| 1596 | may be used in @code{completion-styles-alist} to refer to this style; | 1594 | which may be used in the @code{completion-styles} variable to refer to |
| 1597 | @var{try-completion} is the function that does the completion; | 1595 | this style; @var{try-completion} is the function that does the |
| 1598 | @var{all-completions} is the function that lists the completions; and | 1596 | completion; @var{all-completions} is the function that lists the |
| 1599 | @var{doc} is a string describing the completion style. | 1597 | completions; and @var{doc} is a string describing the completion |
| 1598 | style. | ||
| 1600 | 1599 | ||
| 1601 | The @var{try-completion} and @var{all-completions} functions should | 1600 | The @var{try-completion} and @var{all-completions} functions should |
| 1602 | each accept four arguments: @var{string}, @var{collection}, | 1601 | each accept four arguments: @var{string}, @var{collection}, |
| @@ -1622,6 +1621,31 @@ listing completions, via the @var{all-completions} functions. | |||
| 1622 | description of the available completion styles. | 1621 | description of the available completion styles. |
| 1623 | @end defvar | 1622 | @end defvar |
| 1624 | 1623 | ||
| 1624 | @defopt completion-category-overrides | ||
| 1625 | This variable specifies special completion styles and other completion | ||
| 1626 | behaviors to use when completing certain types of text. Its value | ||
| 1627 | should be a list of the form @code{(@var{category} . @var{alist})}. | ||
| 1628 | @var{category} is a symbol describing what is being completed; | ||
| 1629 | currently, the @code{buffer} and @code{file} categories are defined, | ||
| 1630 | but others can be defined via specialized completion functions | ||
| 1631 | (@pxref{Programmed Completion}). @var{alist} is an association list | ||
| 1632 | describing how completion should behave for the corresponding | ||
| 1633 | category. The following alist keys are supported: | ||
| 1634 | |||
| 1635 | @table @code | ||
| 1636 | @item styles | ||
| 1637 | The value should be a list of completion styles (symbols). | ||
| 1638 | |||
| 1639 | @item cycle | ||
| 1640 | The value should be a value for @code{completion-cycle-threshold} | ||
| 1641 | (@pxref{Completion Options,,, emacs, The GNU Emacs Manual}) for this | ||
| 1642 | category. | ||
| 1643 | @end table | ||
| 1644 | |||
| 1645 | @noindent | ||
| 1646 | Additional alist entries may be defined in the future. | ||
| 1647 | @end defopt | ||
| 1648 | |||
| 1625 | @defvar completion-extra-properties | 1649 | @defvar completion-extra-properties |
| 1626 | This variable is used to specify extra properties of the current | 1650 | This variable is used to specify extra properties of the current |
| 1627 | completion command. It is intended to be let-bound by specialized | 1651 | completion command. It is intended to be let-bound by specialized |
| @@ -1706,9 +1730,48 @@ This specifies a @code{completion-boundaries} operation. The function | |||
| 1706 | should return @code{(boundaries START . END)}, where START is the | 1730 | should return @code{(boundaries START . END)}, where START is the |
| 1707 | position of the beginning boundary in the specified string, and END is | 1731 | position of the beginning boundary in the specified string, and END is |
| 1708 | the position of the end boundary in SUFFIX. | 1732 | the position of the end boundary in SUFFIX. |
| 1733 | |||
| 1734 | @item metadata | ||
| 1735 | This specifies a request for information about the state of the | ||
| 1736 | current completion. The function should return an alist, as described | ||
| 1737 | below. The alist may contain any number of elements. | ||
| 1709 | @end table | 1738 | @end table |
| 1739 | |||
| 1740 | @noindent | ||
| 1741 | If the flag has any other value, the completion function should return | ||
| 1742 | @code{nil}. | ||
| 1710 | @end itemize | 1743 | @end itemize |
| 1711 | 1744 | ||
| 1745 | The following is a list of metadata entries that a completion function | ||
| 1746 | may return in response to a @code{metadata} flag argument: | ||
| 1747 | |||
| 1748 | @table @code | ||
| 1749 | @item category | ||
| 1750 | The value should be a symbol describing what kind of text the | ||
| 1751 | completion function is trying to complete. If the symbol matches one | ||
| 1752 | of the keys in @code{completion-category-overrides}, the usual | ||
| 1753 | completion behavior is overridden. @xref{Completion Variables}. | ||
| 1754 | |||
| 1755 | @item annotation-function | ||
| 1756 | The value should be a function for @dfn{annotating} completions. The | ||
| 1757 | function should take one argument, @var{string}, which is a possible | ||
| 1758 | completion. It should return a string, which is displayed after the | ||
| 1759 | completion @var{string} in the @samp{*Completions*} buffer. | ||
| 1760 | |||
| 1761 | @item display-sort-function | ||
| 1762 | The value should be a function for sorting completions. The function | ||
| 1763 | should take one argument, a list of completion strings, and return a | ||
| 1764 | sorted list of completion strings. It is allowed to alter the input | ||
| 1765 | list destructively. | ||
| 1766 | |||
| 1767 | @item cycle-sort-function | ||
| 1768 | The value should be a function for sorting completions, when | ||
| 1769 | @code{completion-cycle-threshold} is non-@code{nil} and the user is | ||
| 1770 | cycling through completion alternatives. @xref{Completion Options,,, | ||
| 1771 | emacs, The GNU Emacs Manual}. Its argument list and return value are | ||
| 1772 | the same as for @code{display-sort-function}. | ||
| 1773 | @end table | ||
| 1774 | |||
| 1712 | @defun completion-table-dynamic function | 1775 | @defun completion-table-dynamic function |
| 1713 | This function is a convenient way to write a function that can act as | 1776 | This function is a convenient way to write a function that can act as |
| 1714 | programmed completion function. The argument @var{function} should be | 1777 | programmed completion function. The argument @var{function} should be |