summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2007-08-23 18:42:38 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2007-08-23 18:42:38 +0000
commitc1cd583345b00dd16b2851a29206a4ff7f1f60ab (patch)
tree3dc3910aff9bc05b2d5a5dff34fb796e03b2bc68 /lisp
parenta3506c65971b08f076f25dfd1c8e4f4bd03f676a (diff)
downloademacs-c1cd583345b00dd16b2851a29206a4ff7f1f60ab.tar.gz
(complete-with-action): Backport from trunk (for vc-arch.el).
(dynamic-completion-table): Use it it.
Diffstat (limited to 'lisp')
-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 6d7a95367bb..87fd294660d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,26 @@
2007-08-23 Stefan Monnier <monnier@iro.umontreal.ca>
+ * subr.el (complete-with-action): Backport from trunk (for vc-arch.el).
+ (dynamic-completion-table): Use it it.
+
+ * net/browse-url.el: Remove spurious * in custom docstrings.
+ (browse-url-filename-alist): Use new-style backquote.
+
+ * emacs-lisp/backquote.el (backquote-unquote-symbol)
+ (backquote-splice-symbol): Clarify they're not new-style unquotes.
+
+ * emacs-lisp/edebug.el (edebug-list-form, edebug-match-symbol, \,)
+ (\,@): Backslash the , and ,@ which are not new-style unquotes.
+
+ * textmodes/texinfmt.el (\,): Clarify it's not a new-style unquote.
+
+ * net/socks.el (socks-username/password-auth-filter):
+ Remove unused vars `state' and `desired-len'.
+ (socks-parse-services, socks-nslookup-host): Use with-current-buffer.
+ (socks-wait-for-state-change): Use new-style backquotes.
+
+ * pcvs.el (cvs-mode-status): Fix long-standing typo.
+
* emacs-lisp/bytecomp.el (byte-compile-from-buffer): Check old-style
backquotes after each `read' rather than once per buffer.
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."
;;;; Constructing completion tables.
+(defun complete-with-action (action table string pred)
+ "Perform completion ACTION.
+STRING is the string to complete.
+TABLE is the completion table, which should not be a function.
+PRED is a completion predicate.
+ACTION can be one of nil, t or `lambda'."
+ ;; (assert (not (functionp table)))
+ (funcall
+ (cond
+ ((null action) 'try-completion)
+ ((eq action t) 'all-completions)
+ (t 'test-completion))
+ string table pred))
+
(defmacro dynamic-completion-table (fun)
"Use function FUN as a dynamic completion table.
FUN 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
(with-current-buffer (let ((,win (minibuffer-selected-window)))
(if (window-live-p ,win) (window-buffer ,win)
(current-buffer)))
- (cond
- ((eq ,mode t) (all-completions ,string (,fun ,string) ,predicate))
- ((not ,mode) (try-completion ,string (,fun ,string) ,predicate))
- (t (test-completion ,string (,fun ,string) ,predicate)))))))
+ (complete-with-action ,mode (,fun ,string) ,string ,predicate)))))
(defmacro lazy-completion-table (var fun)
;; We used to have `&rest args' where `args' were evaluated late (at the