aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-08-23 18:42:38 +0000
committerStefan Monnier2007-08-23 18:42:38 +0000
commita621c46e3e20ab4335ecee4994d21cb69bca9e94 (patch)
tree58f33bb76cc154df697642ef02c0ef877af0d709
parent5e835c9f55ea49723f02715b8e1fd6d52ea9cac3 (diff)
downloademacs-a621c46e3e20ab4335ecee4994d21cb69bca9e94.tar.gz
emacs-a621c46e3e20ab4335ecee4994d21cb69bca9e94.zip
(complete-with-action): Backport from trunk (for vc-arch.el).
(dynamic-completion-table): Use it it.
-rw-r--r--lisp/ChangeLog21
-rw-r--r--lisp/subr.el19
2 files changed, 36 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3e3e133bbe0..24639e84d79 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,26 @@
12007-08-23 Stefan Monnier <monnier@iro.umontreal.ca> 12007-08-23 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * subr.el (complete-with-action): Backport from trunk (for vc-arch.el).
4 (dynamic-completion-table): Use it it.
5
6 * net/browse-url.el: Remove spurious * in custom docstrings.
7 (browse-url-filename-alist): Use new-style backquote.
8
9 * emacs-lisp/backquote.el (backquote-unquote-symbol)
10 (backquote-splice-symbol): Clarify they're not new-style unquotes.
11
12 * emacs-lisp/edebug.el (edebug-list-form, edebug-match-symbol, \,)
13 (\,@): Backslash the , and ,@ which are not new-style unquotes.
14
15 * textmodes/texinfmt.el (\,): Clarify it's not a new-style unquote.
16
17 * net/socks.el (socks-username/password-auth-filter):
18 Remove unused vars `state' and `desired-len'.
19 (socks-parse-services, socks-nslookup-host): Use with-current-buffer.
20 (socks-wait-for-state-change): Use new-style backquotes.
21
22 * pcvs.el (cvs-mode-status): Fix long-standing typo.
23
3 * emacs-lisp/bytecomp.el (byte-compile-from-buffer): Check old-style 24 * emacs-lisp/bytecomp.el (byte-compile-from-buffer): Check old-style
4 backquotes after each `read' rather than once per buffer. 25 backquotes after each `read' rather than once per buffer.
5 26
diff --git a/lisp/subr.el b/lisp/subr.el
index 8de09b032f5..63bbc110774 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2509,6 +2509,20 @@ The value returned is the value of the last form in BODY."
2509 2509
2510;;;; Constructing completion tables. 2510;;;; Constructing completion tables.
2511 2511
2512(defun complete-with-action (action table string pred)
2513 "Perform completion ACTION.
2514STRING is the string to complete.
2515TABLE is the completion table, which should not be a function.
2516PRED is a completion predicate.
2517ACTION can be one of nil, t or `lambda'."
2518 ;; (assert (not (functionp table)))
2519 (funcall
2520 (cond
2521 ((null action) 'try-completion)
2522 ((eq action t) 'all-completions)
2523 (t 'test-completion))
2524 string table pred))
2525
2512(defmacro dynamic-completion-table (fun) 2526(defmacro dynamic-completion-table (fun)
2513 "Use function FUN as a dynamic completion table. 2527 "Use function FUN as a dynamic completion table.
2514FUN is called with one argument, the string for which completion is required, 2528FUN is called with one argument, the string for which completion is required,
@@ -2530,10 +2544,7 @@ that can be used as the ALIST argument to `try-completion' and
2530 (with-current-buffer (let ((,win (minibuffer-selected-window))) 2544 (with-current-buffer (let ((,win (minibuffer-selected-window)))
2531 (if (window-live-p ,win) (window-buffer ,win) 2545 (if (window-live-p ,win) (window-buffer ,win)
2532 (current-buffer))) 2546 (current-buffer)))
2533 (cond 2547 (complete-with-action ,mode (,fun ,string) ,string ,predicate)))))
2534 ((eq ,mode t) (all-completions ,string (,fun ,string) ,predicate))
2535 ((not ,mode) (try-completion ,string (,fun ,string) ,predicate))
2536 (t (test-completion ,string (,fun ,string) ,predicate)))))))
2537 2548
2538(defmacro lazy-completion-table (var fun) 2549(defmacro lazy-completion-table (var fun)
2539 ;; We used to have `&rest args' where `args' were evaluated late (at the 2550 ;; We used to have `&rest args' where `args' were evaluated late (at the