diff options
| author | Daniel Colascione | 2014-03-30 19:25:02 -0700 |
|---|---|---|
| committer | Daniel Colascione | 2014-03-30 19:25:02 -0700 |
| commit | d94c875df38b62e7942acba41ed5eb26cca4d65f (patch) | |
| tree | 796def334362c7918483e970d555dee01e1a836e /doc | |
| parent | 294b2b0928d7704915a480f43d1eb5c75fc35456 (diff) | |
| download | emacs-d94c875df38b62e7942acba41ed5eb26cca4d65f.tar.gz emacs-d94c875df38b62e7942acba41ed5eb26cca4d65f.zip | |
Discuss using lazy completion tables for inline completion.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/minibuf.texi | 31 |
2 files changed, 32 insertions, 4 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 5c0941b7918..933078e9229 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-03-31 Daniel Colascione <dancol@dancol.org> | ||
| 2 | |||
| 3 | * minibuf.texi (Completion in Buffers): Discuss using lazy | ||
| 4 | completion tables for inline completion. | ||
| 5 | |||
| 1 | 2014-03-28 Glenn Morris <rgm@gnu.org> | 6 | 2014-03-28 Glenn Morris <rgm@gnu.org> |
| 2 | 7 | ||
| 3 | * os.texi (Terminal-Specific): Mention term-file-aliases. | 8 | * os.texi (Terminal-Specific): Mention term-file-aliases. |
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 5b4e29c57a3..a55afb370c7 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi | |||
| @@ -1873,11 +1873,34 @@ next function in @code{completion-at-point-functions} instead of | |||
| 1873 | reporting a completion failure. | 1873 | reporting a completion failure. |
| 1874 | @end table | 1874 | @end table |
| 1875 | 1875 | ||
| 1876 | Supplying a function for @var{collection} is strongly recommended if | ||
| 1877 | generating the list of completions is an expensive operation. Emacs | ||
| 1878 | may internally call functions in @code{completion-at-point-functions} | ||
| 1879 | many times, but care about the value of @var{collection} for only some | ||
| 1880 | of these calls. By supplying a function for @var{collection}, Emacs | ||
| 1881 | can defer generating completions until necessary. You can use | ||
| 1882 | @var{completion-table-dynamic} to create a wrapper function: | ||
| 1883 | |||
| 1884 | @smallexample | ||
| 1885 | ;; Avoid this pattern. | ||
| 1886 | (let ((beg ...) (end ...) (my-completions (my-make-completions))) | ||
| 1887 | (list beg end my-completions)) | ||
| 1888 | |||
| 1889 | ;; Use this instead. | ||
| 1890 | (let ((beg ...) (end ...)) | ||
| 1891 | (list beg | ||
| 1892 | end | ||
| 1893 | (completion-table-dynamic | ||
| 1894 | (lambda (_) | ||
| 1895 | (my-make-completions))))) | ||
| 1896 | @end smallexample | ||
| 1897 | |||
| 1876 | A function in @code{completion-at-point-functions} may also return a | 1898 | A function in @code{completion-at-point-functions} may also return a |
| 1877 | function. In that case, that returned function is called, with no | 1899 | function instead of a list as described above. In that case, that |
| 1878 | argument, and it is entirely responsible for performing the | 1900 | returned function is called, with no argument, and it is entirely |
| 1879 | completion. We discourage this usage; it is intended to help convert | 1901 | responsible for performing the completion. We discourage this usage; |
| 1880 | old code to using @code{completion-at-point}. | 1902 | it is intended to help convert old code to using |
| 1903 | @code{completion-at-point}. | ||
| 1881 | 1904 | ||
| 1882 | The first function in @code{completion-at-point-functions} to return a | 1905 | The first function in @code{completion-at-point-functions} to return a |
| 1883 | non-@code{nil} value is used by @code{completion-at-point}. The | 1906 | non-@code{nil} value is used by @code{completion-at-point}. The |