diff options
| author | Stefan Monnier | 2018-03-27 16:01:30 -0400 |
|---|---|---|
| committer | Eli Zaretskii | 2018-04-01 12:21:29 +0300 |
| commit | 748f0fdd5a682d3bea79e3d30782686eae6d24df (patch) | |
| tree | db57fdb4b599658c132e47ac30fcffcac35ba862 /doc | |
| parent | af1624f29bc264fe0cff31c46b25b0b0c90e24bf (diff) | |
| download | emacs-748f0fdd5a682d3bea79e3d30782686eae6d24df.tar.gz emacs-748f0fdd5a682d3bea79e3d30782686eae6d24df.zip | |
(completion-at-point-functions): Improve doc
(cherry picked from commit b56c56f203f8b066dd71e6ae6a254121b3ac3f08)
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/minibuf.texi | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 0ef81858ea9..b01ebb26b69 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi | |||
| @@ -1877,10 +1877,10 @@ are used to compute a completion table for completing the text at | |||
| 1877 | point. It can be used by major modes to provide mode-specific | 1877 | point. It can be used by major modes to provide mode-specific |
| 1878 | completion tables (@pxref{Major Mode Conventions}). | 1878 | completion tables (@pxref{Major Mode Conventions}). |
| 1879 | 1879 | ||
| 1880 | When the command @code{completion-at-point} runs, it calls the | 1880 | When the command @code{completion-at-point} runs, it calls the functions in the |
| 1881 | functions in the list one by one, without any argument. Each function | 1881 | list one by one, without any argument. Each function should return @code{nil} |
| 1882 | should return @code{nil} if it is unable to produce a completion table | 1882 | unless it can and wants to take responsibility for the completion data for the |
| 1883 | for the text at point. Otherwise it should return a list of the form | 1883 | text at point. Otherwise it should return a list of the form |
| 1884 | 1884 | ||
| 1885 | @example | 1885 | @example |
| 1886 | (@var{start} @var{end} @var{collection} . @var{props}) | 1886 | (@var{start} @var{end} @var{collection} . @var{props}) |
| @@ -1910,6 +1910,8 @@ next function in @code{completion-at-point-functions} instead of | |||
| 1910 | reporting a completion failure. | 1910 | reporting a completion failure. |
| 1911 | @end table | 1911 | @end table |
| 1912 | 1912 | ||
| 1913 | The functions on this hook should generally return quickly, since they may be | ||
| 1914 | called very often (e.g., from @code{post-command-hook}). | ||
| 1913 | Supplying a function for @var{collection} is strongly recommended if | 1915 | Supplying a function for @var{collection} is strongly recommended if |
| 1914 | generating the list of completions is an expensive operation. Emacs | 1916 | generating the list of completions is an expensive operation. Emacs |
| 1915 | may internally call functions in @code{completion-at-point-functions} | 1917 | may internally call functions in @code{completion-at-point-functions} |
| @@ -1932,11 +1934,16 @@ can defer generating completions until necessary. You can use | |||
| 1932 | (my-make-completions))))) | 1934 | (my-make-completions))))) |
| 1933 | @end smallexample | 1935 | @end smallexample |
| 1934 | 1936 | ||
| 1937 | Additionally, the @var{collection} should generally not be pre-filtered based | ||
| 1938 | on the current text between @var{start} and @var{end}, because that is the | ||
| 1939 | responsibility of the caller of @code{completion-at-point-functions} to do that | ||
| 1940 | according to the completion styles it decides to use. | ||
| 1941 | |||
| 1935 | A function in @code{completion-at-point-functions} may also return a | 1942 | A function in @code{completion-at-point-functions} may also return a |
| 1936 | function instead of a list as described above. In that case, that | 1943 | function instead of a list as described above. In that case, that |
| 1937 | returned function is called, with no argument, and it is entirely | 1944 | returned function is called, with no argument, and it is entirely |
| 1938 | responsible for performing the completion. We discourage this usage; | 1945 | responsible for performing the completion. We discourage this usage; |
| 1939 | it is intended to help convert old code to using | 1946 | it is only intended to help convert old code to using |
| 1940 | @code{completion-at-point}. | 1947 | @code{completion-at-point}. |
| 1941 | 1948 | ||
| 1942 | The first function in @code{completion-at-point-functions} to return a | 1949 | The first function in @code{completion-at-point-functions} to return a |