"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\".")
(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
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)))))
"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)))
(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