diff options
| author | Stefan Monnier | 2010-05-30 17:18:35 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2010-05-30 17:18:35 -0400 |
| commit | 637821cd30f9bd3b523d032e2dda22ffee853d51 (patch) | |
| tree | 0d51cb7269db234f29cff8d3816134b925572a44 | |
| parent | fcb5280844c862467b547eaafee54284a34be837 (diff) | |
| download | emacs-637821cd30f9bd3b523d032e2dda22ffee853d51.tar.gz emacs-637821cd30f9bd3b523d032e2dda22ffee853d51.zip | |
* doc/lispref/minibuf.texi (Basic Completion): Document completion-boundaries.
(Programmed Completion): Document the new fourth method for boundaries.
* .bzrignore: Ignore new files from trunk, which appear if you use
colocated branches (i.e. "bzr switch").
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/minibuf.texi | 44 |
3 files changed, 47 insertions, 7 deletions
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-05-30 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * .bzrignore: Ignore new files from trunk, which appear if you use | ||
| 4 | colocated branches (i.e. "bzr switch"). | ||
| 5 | |||
| 1 | 2010-05-10 Miles Bader <miles@gnu.org> | 6 | 2010-05-10 Miles Bader <miles@gnu.org> |
| 2 | 7 | ||
| 3 | * configure.in: Get rid of "unix" pre-defined macro when | 8 | * configure.in: Get rid of "unix" pre-defined macro when |
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 93e958c0746..f07fb257a35 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-05-30 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * minibuf.texi (Basic Completion): Document completion-boundaries. | ||
| 4 | (Programmed Completion): Document the new fourth method for boundaries. | ||
| 5 | |||
| 1 | 2010-05-07 Chong Yidong <cyd@stupidchicken.com> | 6 | 2010-05-07 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 7 | ||
| 3 | * Version 23.2 released. | 8 | * Version 23.2 released. |
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 66b4cb096cc..841c8823188 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi | |||
| @@ -812,6 +812,24 @@ unpredictable. | |||
| 812 | If @var{collection} is a function, it is called with three arguments, | 812 | If @var{collection} is a function, it is called with three arguments, |
| 813 | the values @var{string}, @var{predicate} and @code{lambda}; whatever | 813 | the values @var{string}, @var{predicate} and @code{lambda}; whatever |
| 814 | it returns, @code{test-completion} returns in turn. | 814 | it returns, @code{test-completion} returns in turn. |
| 815 | |||
| 816 | @defun completion-boundaries string collection predicate suffix | ||
| 817 | This function returns the boundaries of the field on which @var{collection} | ||
| 818 | will operate, assuming that @var{string} holds the text before point | ||
| 819 | and @var{suffix} holds the text after point. | ||
| 820 | |||
| 821 | Normally completion operates on the whole string, so for all normal | ||
| 822 | collections, this will always return @code{(0 . (length | ||
| 823 | @var{suffix}))}. But more complex completion such as completion on | ||
| 824 | files is done one field at a time. For example, completion of | ||
| 825 | @code{"/usr/sh"} will include @code{"/usr/share/"} but not | ||
| 826 | @code{"/usr/share/doc"} even if @code{"/usr/share/doc"} exists. | ||
| 827 | Also @code{all-completions} on @code{"/usr/sh"} will not include | ||
| 828 | @code{"/usr/share/"} but only @code{"share/"}. So if @var{string} is | ||
| 829 | @code{"/usr/sh"} and @var{suffix} is @code{"e/doc"}, | ||
| 830 | @code{completion-boundaries} will return @code{(5 . 1)} which tells us | ||
| 831 | that the @var{collection} will only return completion information that | ||
| 832 | pertains to the area after @code{"/usr/"} and before @code{"/doc"}. | ||
| 815 | @end defun | 833 | @end defun |
| 816 | 834 | ||
| 817 | If you store a completion alist in a variable, you should mark the | 835 | If you store a completion alist in a variable, you should mark the |
| @@ -1618,13 +1636,14 @@ containing all the intended possible completions. In such a case, you | |||
| 1618 | can supply your own function to compute the completion of a given | 1636 | can supply your own function to compute the completion of a given |
| 1619 | string. This is called @dfn{programmed completion}. Emacs uses | 1637 | string. This is called @dfn{programmed completion}. Emacs uses |
| 1620 | programmed completion when completing file names (@pxref{File Name | 1638 | programmed completion when completing file names (@pxref{File Name |
| 1621 | Completion}). | 1639 | Completion}), among many other cases. |
| 1622 | 1640 | ||
| 1623 | To use this feature, pass a symbol with a function definition as the | 1641 | To use this feature, pass a function as the @var{collection} |
| 1624 | @var{collection} argument to @code{completing-read}. The function | 1642 | argument to @code{completing-read}. The function |
| 1625 | @code{completing-read} arranges to pass your completion function along | 1643 | @code{completing-read} arranges to pass your completion function along |
| 1626 | to @code{try-completion} and @code{all-completions}, which will then let | 1644 | to @code{try-completion}, @code{all-completions}, and other basic |
| 1627 | your function do all the work. | 1645 | completion functions, which will then let your function do all |
| 1646 | the work. | ||
| 1628 | 1647 | ||
| 1629 | The completion function should accept three arguments: | 1648 | The completion function should accept three arguments: |
| 1630 | 1649 | ||
| @@ -1638,10 +1657,14 @@ none. Your function should call the predicate for each possible match, | |||
| 1638 | and ignore the possible match if the predicate returns @code{nil}. | 1657 | and ignore the possible match if the predicate returns @code{nil}. |
| 1639 | 1658 | ||
| 1640 | @item | 1659 | @item |
| 1641 | A flag specifying the type of operation. | 1660 | A flag specifying the type of operation. The best way to think about |
| 1661 | it is that the function stands for an object (in the | ||
| 1662 | ``object-oriented'' sense of the word), and this third argument | ||
| 1663 | specifies which method to run. | ||
| 1642 | @end itemize | 1664 | @end itemize |
| 1643 | 1665 | ||
| 1644 | There are three flag values for three operations: | 1666 | There are currently four methods, i.e. four flag values, one for |
| 1667 | each of the four different basic operations: | ||
| 1645 | 1668 | ||
| 1646 | @itemize @bullet | 1669 | @itemize @bullet |
| 1647 | @item | 1670 | @item |
| @@ -1663,6 +1686,13 @@ string. | |||
| 1663 | @code{lambda} specifies @code{test-completion}. The completion | 1686 | @code{lambda} specifies @code{test-completion}. The completion |
| 1664 | function should return @code{t} if the specified string is an exact | 1687 | function should return @code{t} if the specified string is an exact |
| 1665 | match for some possibility; @code{nil} otherwise. | 1688 | match for some possibility; @code{nil} otherwise. |
| 1689 | |||
| 1690 | @item | ||
| 1691 | @code{(boundaries . SUFFIX)} specifies @code{completion-boundaries}. | ||
| 1692 | The function should return a value of the form @code{(boundaries | ||
| 1693 | START . END)} where START is the position of the beginning boundary in | ||
| 1694 | in the string to complete, and END is the position of the end boundary | ||
| 1695 | in SUFFIX. | ||
| 1666 | @end itemize | 1696 | @end itemize |
| 1667 | 1697 | ||
| 1668 | It would be consistent and clean for completion functions to allow | 1698 | It would be consistent and clean for completion functions to allow |