diff options
| author | Chong Yidong | 2012-04-04 17:19:32 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-04-04 17:19:32 +0800 |
| commit | 321cc491c5843ee3af86570d5b2d59b98ba0c422 (patch) | |
| tree | 118c8469015212fc05c255de56d2b72eba2be128 /doc | |
| parent | a7972adfd8c545a603e395153ba6537e6d573864 (diff) | |
| download | emacs-321cc491c5843ee3af86570d5b2d59b98ba0c422.tar.gz emacs-321cc491c5843ee3af86570d5b2d59b98ba0c422.zip | |
Document completion-extra-properties in Lisp manual.
* doc/lispref/minibuf.texi (Programmed Completion): Remove obsolete variable
completion-annotate-function.
(Completion Variables): Rename from Completion Styles. Document
completion-extra-properties. Document completion-styles-alist
change.
* lisp/minibuffer.el (completion-extra-properties): Doc fix.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 4 | ||||
| -rw-r--r-- | doc/lispref/minibuf.texi | 191 | ||||
| -rw-r--r-- | doc/lispref/vol1.texi | 4 | ||||
| -rw-r--r-- | doc/lispref/vol2.texi | 4 |
5 files changed, 112 insertions, 97 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 89e740603f8..6385400572e 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2012-04-04 Chong Yidong <cyd@gnu.org> | 1 | 2012-04-04 Chong Yidong <cyd@gnu.org> |
| 2 | 2 | ||
| 3 | * minibuf.texi (Programmed Completion): Remove obsolete variable | ||
| 4 | completion-annotate-function. | ||
| 5 | (Completion Variables): Rename from Completion Styles. Document | ||
| 6 | completion-extra-properties. Document completion-styles-alist | ||
| 7 | change. | ||
| 8 | |||
| 3 | * display.texi (Delayed Warnings): New node. | 9 | * display.texi (Delayed Warnings): New node. |
| 4 | 10 | ||
| 5 | * os.texi (Notifications): Copyedits. | 11 | * os.texi (Notifications): Copyedits. |
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 508b0251a7a..a87a7ff3fa2 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -649,8 +649,8 @@ Completion | |||
| 649 | (reading buffer name, file name, etc.). | 649 | (reading buffer name, file name, etc.). |
| 650 | * Reading File Names:: Using completion to read file names and | 650 | * Reading File Names:: Using completion to read file names and |
| 651 | shell commands. | 651 | shell commands. |
| 652 | * Completion Styles:: Specifying rules for performing completion. | 652 | * Completion Variables:: Variables controlling completion behavior. |
| 653 | * Programmed Completion:: Writing your own completion-function. | 653 | * Programmed Completion:: Writing your own completion function. |
| 654 | * Completion in Buffers:: Completing text in ordinary buffers. | 654 | * Completion in Buffers:: Completing text in ordinary buffers. |
| 655 | 655 | ||
| 656 | Command Loop | 656 | Command Loop |
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 1224d80fdf8..0d7e2350bd7 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi | |||
| @@ -631,8 +631,8 @@ for reading certain kinds of names with completion. | |||
| 631 | (reading buffer name, file name, etc.). | 631 | (reading buffer name, file name, etc.). |
| 632 | * Reading File Names:: Using completion to read file names and | 632 | * Reading File Names:: Using completion to read file names and |
| 633 | shell commands. | 633 | shell commands. |
| 634 | * Completion Styles:: Specifying rules for performing completion. | 634 | * Completion Variables:: Variables controlling completion behavior. |
| 635 | * Programmed Completion:: Writing your own completion-function. | 635 | * Programmed Completion:: Writing your own completion function. |
| 636 | * Completion in Buffers:: Completing text in ordinary buffers. | 636 | * Completion in Buffers:: Completing text in ordinary buffers. |
| 637 | @end menu | 637 | @end menu |
| 638 | 638 | ||
| @@ -795,7 +795,7 @@ example for @code{try-completion}: | |||
| 795 | @defun test-completion string collection &optional predicate | 795 | @defun test-completion string collection &optional predicate |
| 796 | @anchor{Definition of test-completion} | 796 | @anchor{Definition of test-completion} |
| 797 | This function returns non-@code{nil} if @var{string} is a valid | 797 | This function returns non-@code{nil} if @var{string} is a valid |
| 798 | completion possibility specified by @var{collection} and | 798 | completion alternative specified by @var{collection} and |
| 799 | @var{predicate}. The arguments are the same as in | 799 | @var{predicate}. The arguments are the same as in |
| 800 | @code{try-completion}. For instance, if @var{collection} is a list of | 800 | @code{try-completion}. For instance, if @var{collection} is a list of |
| 801 | strings, this is true if @var{string} appears in the list and | 801 | strings, this is true if @var{string} appears in the list and |
| @@ -1429,7 +1429,7 @@ current buffer visit no file using @code{M-x set-visited-file-name}. | |||
| 1429 | 1429 | ||
| 1430 | If @var{predicate} is non-@code{nil}, it specifies a function of one | 1430 | If @var{predicate} is non-@code{nil}, it specifies a function of one |
| 1431 | argument that decides which file names are acceptable completion | 1431 | argument that decides which file names are acceptable completion |
| 1432 | possibilities. A file name is an acceptable value if @var{predicate} | 1432 | alternatives. A file name is an acceptable value if @var{predicate} |
| 1433 | returns non-@code{nil} for it. | 1433 | returns non-@code{nil} for it. |
| 1434 | 1434 | ||
| 1435 | Here is an example of using @code{read-file-name}: | 1435 | Here is an example of using @code{read-file-name}: |
| @@ -1480,7 +1480,7 @@ when performing completion. | |||
| 1480 | 1480 | ||
| 1481 | @defun read-directory-name prompt &optional directory default require-match initial | 1481 | @defun read-directory-name prompt &optional directory default require-match initial |
| 1482 | This function is like @code{read-file-name} but allows only directory | 1482 | This function is like @code{read-file-name} but allows only directory |
| 1483 | names as completion possibilities. | 1483 | names as completion alternatives. |
| 1484 | 1484 | ||
| 1485 | If @var{default} is @code{nil} and @var{initial} is non-@code{nil}, | 1485 | If @var{default} is @code{nil} and @var{initial} is non-@code{nil}, |
| 1486 | @code{read-directory-name} constructs a substitute default by | 1486 | @code{read-directory-name} constructs a substitute default by |
| @@ -1563,57 +1563,85 @@ This keymap is used by @code{read-shell-command} for completing | |||
| 1563 | command and file names that are part of a shell command. | 1563 | command and file names that are part of a shell command. |
| 1564 | @end defvar | 1564 | @end defvar |
| 1565 | 1565 | ||
| 1566 | @node Completion Styles | 1566 | @node Completion Variables |
| 1567 | @subsection Completion Styles | 1567 | @subsection Completion Variables |
| 1568 | @cindex completion styles | ||
| 1569 | 1568 | ||
| 1570 | A @dfn{completion style} is a set of rules for generating | 1569 | Here are some variables which can be used to alter the default |
| 1571 | completions. The user option @code{completion-styles} stores a list | 1570 | completion behavior. |
| 1572 | of completion styles, which are represented by symbols. | ||
| 1573 | 1571 | ||
| 1572 | @cindex completion styles | ||
| 1574 | @defopt completion-styles | 1573 | @defopt completion-styles |
| 1575 | This is a list of completion style symbols to use for performing | 1574 | The value of this variable is a list of completion styles to use for |
| 1576 | completion. Each completion style in this list must be defined in | 1575 | performing completion. A @dfn{completion style} is a set of rules for |
| 1576 | generating completions. | ||
| 1577 | |||
| 1578 | Each style listed in this variable must be one of those defined in | ||
| 1577 | @code{completion-styles-alist}. | 1579 | @code{completion-styles-alist}. |
| 1578 | @end defopt | 1580 | @end defopt |
| 1579 | 1581 | ||
| 1580 | @defvar completion-styles-alist | 1582 | @defvar completion-styles-alist |
| 1581 | This variable stores a list of available completion styles. Each | 1583 | This variable stores a list of available completion styles. Each |
| 1582 | element in the list must have the form @samp{(@var{name} | 1584 | element in the list has the form |
| 1583 | @var{try-completion} @var{all-completions})}. Here, @var{name} is the | 1585 | |
| 1584 | name of the completion style (a symbol), which may be used in | 1586 | @example |
| 1585 | @code{completion-styles-alist} to refer to this style. | 1587 | (@var{name} @var{try-completion} @var{all-completions} @var{doc}) |
| 1586 | 1588 | @end example | |
| 1587 | @var{try-completion} is the function that does the completion, and | 1589 | |
| 1588 | @var{all-completions} is the function that lists the completions. | 1590 | @noindent |
| 1589 | These functions should accept four arguments: @var{string}, | 1591 | Here, @var{name} is the name of the completion style (a symbol), which |
| 1590 | @var{collection}, @var{predicate}, and @var{point}. The @var{string}, | 1592 | may be used in @code{completion-styles-alist} to refer to this style; |
| 1591 | @var{collection}, and @var{predicate} arguments have the same meanings | 1593 | @var{try-completion} is the function that does the completion; |
| 1592 | as in @code{try-completion} (@pxref{Basic Completion}), and the | 1594 | @var{all-completions} is the function that lists the completions; and |
| 1593 | @var{point} argument is the position of point within @var{string}. | 1595 | @var{doc} is a string describing the completion style. |
| 1594 | Each function should return a non-@code{nil} value if it performed its | 1596 | |
| 1595 | job, and @code{nil} if it did not (e.g., if there is no way to | 1597 | The @var{try-completion} and @var{all-completions} functions should |
| 1596 | complete @var{string} according to the completion style). | 1598 | each accept four arguments: @var{string}, @var{collection}, |
| 1597 | 1599 | @var{predicate}, and @var{point}. The @var{string}, @var{collection}, | |
| 1598 | When the user calls a completion command, such as | 1600 | and @var{predicate} arguments have the same meanings as in |
| 1601 | @code{try-completion} (@pxref{Basic Completion}), and the @var{point} | ||
| 1602 | argument is the position of point within @var{string}. Each function | ||
| 1603 | should return a non-@code{nil} value if it performed its job, and | ||
| 1604 | @code{nil} if it did not (e.g.@: if there is no way to complete | ||
| 1605 | @var{string} according to the completion style). | ||
| 1606 | |||
| 1607 | When the user calls a completion command like | ||
| 1599 | @code{minibuffer-complete} (@pxref{Completion Commands}), Emacs looks | 1608 | @code{minibuffer-complete} (@pxref{Completion Commands}), Emacs looks |
| 1600 | for the first style listed in @code{completion-styles} and calls its | 1609 | for the first style listed in @code{completion-styles} and calls its |
| 1601 | @var{try-completion} function. If this function returns @code{nil}, | 1610 | @var{try-completion} function. If this function returns @code{nil}, |
| 1602 | Emacs moves to the next completion style listed in | 1611 | Emacs moves to the next listed completion style and calls its |
| 1603 | @code{completion-styles} and calls its @var{try-completion} function, | 1612 | @var{try-completion} function, and so on until one of the |
| 1604 | and so on until one of the @var{try-completion} functions successfully | 1613 | @var{try-completion} functions successfully performs completion and |
| 1605 | performs completion and returns a non-@code{nil} value. A similar | 1614 | returns a non-@code{nil} value. A similar procedure is used for |
| 1606 | procedure is used for listing completions, via the | 1615 | listing completions, via the @var{all-completions} functions. |
| 1607 | @var{all-completions} functions. | 1616 | |
| 1617 | @xref{Completion Styles,,, emacs, The GNU Emacs Manual}, for a | ||
| 1618 | description of the available completion styles. | ||
| 1608 | @end defvar | 1619 | @end defvar |
| 1609 | 1620 | ||
| 1610 | By default, @code{completion-styles-alist} contains five pre-defined | 1621 | @defvar completion-extra-properties |
| 1611 | completion styles: @code{basic}, a basic completion style; | 1622 | This variable is used to specify extra properties of the current |
| 1612 | @code{partial-completion}, which does partial completion (completing | 1623 | completion command. It is intended to be let-bound by specialized |
| 1613 | each word in the input separately); @code{emacs22}, which performs | 1624 | completion commands. Its value should be a list of property and value |
| 1614 | completion according to the rules used in Emacs 22; @code{emacs21}, | 1625 | pairs. The following properties are supported: |
| 1615 | which performs completion according to the rules used in Emacs 21; and | 1626 | |
| 1616 | @code{initials}, which completes acronyms and initialisms. | 1627 | @table @code |
| 1628 | @item :annotation-function | ||
| 1629 | The value should be a function to add annotations in the completions | ||
| 1630 | buffer. This function must accept one argument, a completion, and | ||
| 1631 | should either return @code{nil} or a string to be displayed next to | ||
| 1632 | the completion. | ||
| 1633 | |||
| 1634 | @item :exit-function | ||
| 1635 | The value should be a function to run after performing completion. | ||
| 1636 | The function should accept two arguments, @var{string} and | ||
| 1637 | @var{status}, where @var{string} is the text to which the field was | ||
| 1638 | completed and @var{status} indicates what kind of operation happened: | ||
| 1639 | @code{finished} if text is now complete, @code{sole} if the text | ||
| 1640 | cannot be further completed but completion is not finished, or | ||
| 1641 | @code{exact} if the text is a valid completion but may be further | ||
| 1642 | completed. | ||
| 1643 | @end table | ||
| 1644 | @end defvar | ||
| 1617 | 1645 | ||
| 1618 | @node Programmed Completion | 1646 | @node Programmed Completion |
| 1619 | @subsection Programmed Completion | 1647 | @subsection Programmed Completion |
| @@ -1640,47 +1668,41 @@ the work. | |||
| 1640 | The string to be completed. | 1668 | The string to be completed. |
| 1641 | 1669 | ||
| 1642 | @item | 1670 | @item |
| 1643 | The predicate function to filter possible matches, or @code{nil} if | 1671 | A predicate function with which to filter possible matches, or |
| 1644 | none. Your function should call the predicate for each possible match, | 1672 | @code{nil} if none. The function should call the predicate for each |
| 1645 | and ignore the possible match if the predicate returns @code{nil}. | 1673 | possible match, and ignore the match if the predicate returns |
| 1674 | @code{nil}. | ||
| 1646 | 1675 | ||
| 1647 | @item | 1676 | @item |
| 1648 | A flag specifying the type of operation. The best way to think about | 1677 | A flag specifying the type of completion operation to perform. This |
| 1649 | it is that the function stands for an object (in the | 1678 | is one of the following four values: |
| 1650 | ``object-oriented'' sense of the word), and this third argument | ||
| 1651 | specifies which method to run. | ||
| 1652 | @end itemize | ||
| 1653 | 1679 | ||
| 1654 | There are currently four methods, i.e. four flag values, one for | 1680 | @table @code |
| 1655 | each of the four different basic operations: | 1681 | @item nil |
| 1656 | 1682 | This specifies a @code{try-completion} operation. The function should | |
| 1657 | @itemize @bullet | 1683 | return @code{t} if the specified string is a unique and exact match; |
| 1658 | @item | 1684 | if there is more than one match, it should return the common substring |
| 1659 | @code{nil} specifies @code{try-completion}. The completion function | 1685 | of all matches (if the string is an exact match for one completion |
| 1660 | should return the completion of the specified string, or @code{t} if the | 1686 | alternative but also matches other longer alternatives, the return |
| 1661 | string is a unique and exact match already, or @code{nil} if the string | 1687 | value is the string); if there are no matches, it should return |
| 1662 | matches no possibility. | 1688 | @code{nil}. |
| 1663 | 1689 | ||
| 1664 | If the string is an exact match for one possibility, but also matches | 1690 | @item t |
| 1665 | other longer possibilities, the function should return the string, not | 1691 | This specifies an @code{all-completions} operation. The function |
| 1666 | @code{t}. | ||
| 1667 | |||
| 1668 | @item | ||
| 1669 | @code{t} specifies @code{all-completions}. The completion function | ||
| 1670 | should return a list of all possible completions of the specified | 1692 | should return a list of all possible completions of the specified |
| 1671 | string. | 1693 | string. |
| 1672 | 1694 | ||
| 1673 | @item | 1695 | @item lambda |
| 1674 | @code{lambda} specifies @code{test-completion}. The completion | 1696 | This specifies a @code{test-completion} operation. The function |
| 1675 | function should return @code{t} if the specified string is an exact | 1697 | should return @code{t} if the specified string is an exact match for |
| 1676 | match for some possibility; @code{nil} otherwise. | 1698 | some completion alternative; @code{nil} otherwise. |
| 1677 | 1699 | ||
| 1678 | @item | 1700 | @item (boundaries . @var{suffix}) |
| 1679 | @code{(boundaries . SUFFIX)} specifies @code{completion-boundaries}. | 1701 | This specifies a @code{completion-boundaries} operation. The function |
| 1680 | The function should return a value of the form @code{(boundaries | 1702 | should return @code{(boundaries START . END)}, where START is the |
| 1681 | START . END)} where START is the position of the beginning boundary | 1703 | position of the beginning boundary in the specified string, and END is |
| 1682 | in the string to complete, and END is the position of the end boundary | 1704 | the position of the end boundary in SUFFIX. |
| 1683 | in SUFFIX. | 1705 | @end table |
| 1684 | @end itemize | 1706 | @end itemize |
| 1685 | 1707 | ||
| 1686 | @defun completion-table-dynamic function | 1708 | @defun completion-table-dynamic function |
| @@ -1692,19 +1714,6 @@ possible completions of it. You can think of | |||
| 1692 | and the interface for programmed completion functions. | 1714 | and the interface for programmed completion functions. |
| 1693 | @end defun | 1715 | @end defun |
| 1694 | 1716 | ||
| 1695 | @defvar completion-annotate-function | ||
| 1696 | The value of this variable, if non-@code{nil}, should be a function | ||
| 1697 | for ``annotating'' the entries in the @samp{*Completions*} buffer. | ||
| 1698 | The function should accept a single argument, the completion string | ||
| 1699 | for an entry. It should return an additional string to display next | ||
| 1700 | to that entry in the @samp{*Completions*} buffer, or @code{nil} if no | ||
| 1701 | additional string is to be displayed. | ||
| 1702 | |||
| 1703 | The function can determine the collection used for the current | ||
| 1704 | completion via the variable @code{minibuffer-completion-table} | ||
| 1705 | (@pxref{Completion Commands}). | ||
| 1706 | @end defvar | ||
| 1707 | |||
| 1708 | @node Completion in Buffers | 1717 | @node Completion in Buffers |
| 1709 | @subsection Completion in Ordinary Buffers | 1718 | @subsection Completion in Ordinary Buffers |
| 1710 | @cindex inline completion | 1719 | @cindex inline completion |
| @@ -1740,7 +1749,7 @@ that text, in a form suitable for passing as the second argument to | |||
| 1740 | @code{try-completion} (@pxref{Basic Completion}); completion | 1749 | @code{try-completion} (@pxref{Basic Completion}); completion |
| 1741 | alternatives will be generated from this completion table in the usual | 1750 | alternatives will be generated from this completion table in the usual |
| 1742 | way, via the completion styles defined in @code{completion-styles} | 1751 | way, via the completion styles defined in @code{completion-styles} |
| 1743 | (@pxref{Completion Styles}). @var{props} is a property list for | 1752 | (@pxref{Completion Variables}). @var{props} is a property list for |
| 1744 | additional information; the following optional properties are | 1753 | additional information; the following optional properties are |
| 1745 | recognized: | 1754 | recognized: |
| 1746 | 1755 | ||
diff --git a/doc/lispref/vol1.texi b/doc/lispref/vol1.texi index 52681510a51..e1fe8ba3277 100644 --- a/doc/lispref/vol1.texi +++ b/doc/lispref/vol1.texi | |||
| @@ -671,8 +671,8 @@ Completion | |||
| 671 | (reading buffer name, file name, etc.). | 671 | (reading buffer name, file name, etc.). |
| 672 | * Reading File Names:: Using completion to read file names and | 672 | * Reading File Names:: Using completion to read file names and |
| 673 | shell commands. | 673 | shell commands. |
| 674 | * Completion Styles:: Specifying rules for performing completion. | 674 | * Completion Variables:: Variables controlling completion behavior. |
| 675 | * Programmed Completion:: Writing your own completion-function. | 675 | * Programmed Completion:: Writing your own completion function. |
| 676 | * Completion in Buffers:: Completing text in ordinary buffers. | 676 | * Completion in Buffers:: Completing text in ordinary buffers. |
| 677 | 677 | ||
| 678 | Command Loop | 678 | Command Loop |
diff --git a/doc/lispref/vol2.texi b/doc/lispref/vol2.texi index 3be2628f5e1..650d1672538 100644 --- a/doc/lispref/vol2.texi +++ b/doc/lispref/vol2.texi | |||
| @@ -670,8 +670,8 @@ Completion | |||
| 670 | (reading buffer name, file name, etc.). | 670 | (reading buffer name, file name, etc.). |
| 671 | * Reading File Names:: Using completion to read file names and | 671 | * Reading File Names:: Using completion to read file names and |
| 672 | shell commands. | 672 | shell commands. |
| 673 | * Completion Styles:: Specifying rules for performing completion. | 673 | * Completion Variables:: Variables controlling completion behavior. |
| 674 | * Programmed Completion:: Writing your own completion-function. | 674 | * Programmed Completion:: Writing your own completion function. |
| 675 | * Completion in Buffers:: Completing text in ordinary buffers. | 675 | * Completion in Buffers:: Completing text in ordinary buffers. |
| 676 | 676 | ||
| 677 | Command Loop | 677 | Command Loop |