changeset 28741:efa45c683e9a

(crm-completion-table): New variable. (crm-collection-fn, crm-test-completion) (completing-read-multiple): Use it.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 27 Apr 2000 19:00:09 +0000
parents 14cc47ddd47a
children 4b2207602eef
files lisp/emacs-lisp/crm.el
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/crm.el	Thu Apr 27 18:58:13 2000 +0000
+++ b/lisp/emacs-lisp/crm.el	Thu Apr 27 19:00:09 2000 +0000
@@ -109,6 +109,11 @@
   "Local keymap for minibuffer multiple input with exact match completion.
 Analog of `minibuffer-local-must-match-map' for crm.")
 
+(defvar crm-completion-table nil
+  "An alist whose elements' cars are strings, or an obarray.
+This is a table used for completion by `completing-read-multiple' and its
+supporting functions.")
+
 ;; this is supposed to be analogous to last_exact_completion in src/minibuf.c
 (defvar crm-last-exact-completion nil
   "Completion string if last attempt reported \"Complete, but not unique\".")
@@ -160,7 +165,7 @@
       (setq string (substring string (match-end 0))))
     (if (eq flag 'lambda)
 	;; return t for exact match, nil otherwise
-	(let ((result (try-completion string table predicate)))
+	(let ((result (try-completion string crm-completion-table predicate)))
 	  (if (stringp result)
 	      nil
 	    (if result
@@ -168,9 +173,9 @@
 	      nil))))
       (if flag
 	  ;; called via (all-completions string 'crm-completion-fn predicate)?
-	  (all-completions string table predicate)
+	  (all-completions string crm-completion-table predicate)
 	;; called via (try-completion string 'crm-completion-fn predicate)?
-	(let ((result (try-completion string table predicate)))
+	(let ((result (try-completion string crm-completion-table predicate)))
 	  (if (stringp result)
 	      (concat lead result)
 	    result)))))
@@ -221,7 +226,8 @@
   "Return t if CANDIDATE is an exact match for a valid completion."
   (let ((completions
 	 ;; TODO: verify whether the arguments are appropriate
-	 (all-completions candidate table minibuffer-completion-predicate)))
+	 (all-completions 
+	  candidate crm-completion-table minibuffer-completion-predicate)))
     (if (member candidate completions)
 	t
       nil)))
@@ -587,6 +593,7 @@
 	(minibuffer-completion-confirm (if (eq require-match t)
 					   nil
 					 t))
+	(crm-completion-table table)
 	crm-last-exact-completion
 	crm-current-element
 	crm-left-of-element