aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDaniel Colascione2014-03-30 19:25:02 -0700
committerDaniel Colascione2014-03-30 19:25:02 -0700
commitd94c875df38b62e7942acba41ed5eb26cca4d65f (patch)
tree796def334362c7918483e970d555dee01e1a836e /doc
parent294b2b0928d7704915a480f43d1eb5c75fc35456 (diff)
downloademacs-d94c875df38b62e7942acba41ed5eb26cca4d65f.tar.gz
emacs-d94c875df38b62e7942acba41ed5eb26cca4d65f.zip
Discuss using lazy completion tables for inline completion.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/minibuf.texi31
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 @@
12014-03-31 Daniel Colascione <dancol@dancol.org>
2
3 * minibuf.texi (Completion in Buffers): Discuss using lazy
4 completion tables for inline completion.
5
12014-03-28 Glenn Morris <rgm@gnu.org> 62014-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
1873reporting a completion failure. 1873reporting a completion failure.
1874@end table 1874@end table
1875 1875
1876Supplying a function for @var{collection} is strongly recommended if
1877generating the list of completions is an expensive operation. Emacs
1878may internally call functions in @code{completion-at-point-functions}
1879many times, but care about the value of @var{collection} for only some
1880of these calls. By supplying a function for @var{collection}, Emacs
1881can 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
1876A function in @code{completion-at-point-functions} may also return a 1898A function in @code{completion-at-point-functions} may also return a
1877function. In that case, that returned function is called, with no 1899function instead of a list as described above. In that case, that
1878argument, and it is entirely responsible for performing the 1900returned function is called, with no argument, and it is entirely
1879completion. We discourage this usage; it is intended to help convert 1901responsible for performing the completion. We discourage this usage;
1880old code to using @code{completion-at-point}. 1902it is intended to help convert old code to using
1903@code{completion-at-point}.
1881 1904
1882The first function in @code{completion-at-point-functions} to return a 1905The first function in @code{completion-at-point-functions} to return a
1883non-@code{nil} value is used by @code{completion-at-point}. The 1906non-@code{nil} value is used by @code{completion-at-point}. The