aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2014-02-27 00:01:22 -0800
committerGlenn Morris2014-02-27 00:01:22 -0800
commitea7826ba52b21e97c27ccf4859eaeb8dca61319b (patch)
treec9326adac81b8bfca0411ea1cd85972c4fec3c5d
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.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/minibuf.texi7
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/minibuffer.el14
5 files changed, 28 insertions, 7 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 6a105a03b3b..6eb45dc3f4f 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12014-02-27 Glenn Morris <rgm@gnu.org>
2
3 * minibuf.texi (Programmed Completion):
4 Mention completion-table-with-cache.
5
12014-02-25 Glenn Morris <rgm@gnu.org> 62014-02-25 Glenn Morris <rgm@gnu.org>
2 7
3 * display.texi (Window Systems): 8 * display.texi (Window Systems):
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index d618912de8a..fded0dfdd92 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1814,6 +1814,13 @@ possible completions of it. You can think of
1814and the interface for programmed completion functions. 1814and the interface for programmed completion functions.
1815@end defun 1815@end defun
1816 1816
1817@defun completion-table-with-cache function &optional ignore-case
1818This is a wrapper for @code{completion-table-dynamic} that saves the
1819last argument-result pair. This means that multiple lookups with the
1820same argument only need to call @var{function} once. This can be useful
1821when a slow operation is involved, such as calling an external process.
1822@end defun
1823
1817@node Completion in Buffers 1824@node Completion in Buffers
1818@subsection Completion in Ordinary Buffers 1825@subsection Completion in Ordinary Buffers
1819@cindex inline completion 1826@cindex inline completion
diff --git a/etc/NEWS b/etc/NEWS
index b224457b233..5a1863254d4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1183,15 +1183,17 @@ Either use `completion-all-completions', which returns highlighted
1183strings (including for partial or substring completion), or call 1183strings (including for partial or substring completion), or call
1184`completion-hilit-commonality' to add the highlight. 1184`completion-hilit-commonality' to add the highlight.
1185 1185
1186+++
1186*** New function `completion-table-with-cache' is a wrapper for 1187*** New function `completion-table-with-cache' is a wrapper for
1187`completion-table-dynamic' that caches the result of the last lookup. 1188`completion-table-dynamic' that caches the result of the last lookup.
1188 1189
1190+++
1189*** New function `completion-table-merge' to combine several 1191*** New function `completion-table-merge' to combine several
1190completion tables by merging their completions. 1192completion tables by merging their completions.
1191 1193
1192** New minor modes `prettify-symbols-mode' and `global-prettify-symbols-mode' 1194** New minor modes `prettify-symbols-mode' and `global-prettify-symbols-mode'
1193let you enable symbol prettification (replacing a string like "lambda" with 1195display specified symbols as composed characters. E.g., in Emacs Lisp mode,
1194the Greek lambda character). 1196this replaces the string "lambda" with the Greek lambda character.
1195 1197
1196** Terminal changes 1198** Terminal changes
1197 1199
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0198c0f8dc5..66514f7488c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12014-02-27 Glenn Morris <rgm@gnu.org> 12014-02-27 Glenn Morris <rgm@gnu.org>
2 2
3 * minibuffer.el (completion-table-dynamic)
4 (completion-table-with-cache): Doc fixes.
5
3 * emacs-lisp/crm.el (crm-default-separator, crm-separator) 6 * emacs-lisp/crm.el (crm-default-separator, crm-separator)
4 (completing-read-multiple): Doc fixes. 7 (completing-read-multiple): Doc fixes.
5 8
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)