aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorGlenn Morris2014-02-27 00:01:22 -0800
committerGlenn Morris2014-02-27 00:01:22 -0800
commitea7826ba52b21e97c27ccf4859eaeb8dca61319b (patch)
treec9326adac81b8bfca0411ea1cd85972c4fec3c5d /lisp/minibuffer.el
parentd926361813de2d50b42e63f1b9b603220ead6c7d (diff)
downloademacs-ea7826ba52b21e97c27ccf4859eaeb8dca61319b.tar.gz
emacs-ea7826ba52b21e97c27ccf4859eaeb8dca61319b.zip
Small doc related to new completion functions
* doc/lispref/minibuf.texi (Programmed Completion): Mention completion-table-with-cache. * lisp/minibuffer.el (completion-table-dynamic) (completion-table-with-cache): Doc fixes. * etc/NEWS: Related markup. Unrelated copyedit.
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 95e45260f85..88ab94f0521 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -179,7 +179,9 @@ FUN will be called in the buffer from which the minibuffer was entered.
179 179
180The result of the `completion-table-dynamic' form is a function 180The result of the `completion-table-dynamic' form is a function
181that can be used as the COLLECTION argument to `try-completion' and 181that can be used as the COLLECTION argument to `try-completion' and
182`all-completions'. See Info node `(elisp)Programmed Completion'." 182`all-completions'. See Info node `(elisp)Programmed Completion'.
183
184See also the related function `completion-table-with-cache'."
183 (lambda (string pred action) 185 (lambda (string pred action)
184 (if (or (eq (car-safe action) 'boundaries) (eq action 'metadata)) 186 (if (or (eq (car-safe action) 'boundaries) (eq action 'metadata))
185 ;; `fun' is not supposed to return another function but a plain old 187 ;; `fun' is not supposed to return another function but a plain old
@@ -191,13 +193,15 @@ that can be used as the COLLECTION argument to `try-completion' and
191 (complete-with-action action (funcall fun string) string pred))))) 193 (complete-with-action action (funcall fun string) string pred)))))
192 194
193(defun completion-table-with-cache (fun &optional ignore-case) 195(defun completion-table-with-cache (fun &optional ignore-case)
194 "Create dynamic completion table from FUN, with cache. 196 "Create dynamic completion table from function FUN, with cache.
195This wraps `completion-table-dynamic', but saves the last 197This is a wrapper for `completion-table-dynamic' that saves the last
196argument-result pair from FUN, so that several lookups with the 198argument-result pair from FUN, so that several lookups with the
197same argument (or with an argument that starts with the first one) 199same argument (or with an argument that starts with the first one)
198only need to call FUN once. Most useful when FUN performs a relatively 200only need to call FUN once. This can be useful when FUN performs a
199slow operation, such as calling an external process (see Bug#11906). 201relatively slow operation, such as calling an external process.
202
200When IGNORE-CASE is non-nil, FUN is expected to be case-insensitive." 203When IGNORE-CASE is non-nil, FUN is expected to be case-insensitive."
204 ;; See eg bug#11906.
201 (let* (last-arg last-result 205 (let* (last-arg last-result
202 (new-fun 206 (new-fun
203 (lambda (arg) 207 (lambda (arg)