(completing-read-multiple): Better preserve

the value of require-match in minibuffer-completion-confirm.
Use crm-local-completion-map.
This commit is contained in:
Stefan Monnier 2001-11-30 01:13:59 +00:00
parent e0b163225f
commit d006d95766

View file

@ -41,7 +41,7 @@
;; `crm-default-separator' (comma). The separator character may be ;; `crm-default-separator' (comma). The separator character may be
;; changed by modifying the value of `crm-separator'. ;; changed by modifying the value of `crm-separator'.
;; Continguous strings of non-separator-characters are referred to as ;; Contiguous strings of non-separator-characters are referred to as
;; 'elements'. In the aforementioned example, the elements are: ;; 'elements'. In the aforementioned example, the elements are:
;; 'alice', 'bob', and 'eve'. ;; 'alice', 'bob', and 'eve'.
@ -529,7 +529,7 @@ This keymap inherits from the keymap named `minibuffer-local-completion-map'.
The only difference is that TAB is bound to `crm-minibuffer-complete' in The only difference is that TAB is bound to `crm-minibuffer-complete' in
the inheriting keymap. the inheriting keymap.
If REQUIRE-MACTH is non-nil, the keymap `crm-local-must-match-map' is used. If REQUIRE-MATCH is non-nil, the keymap `crm-local-must-match-map' is used.
This keymap inherits from the keymap named `minibuffer-local-must-match-map'. This keymap inherits from the keymap named `minibuffer-local-must-match-map'.
The inheriting keymap binds RET to `crm-minibuffer-complete-and-exit' The inheriting keymap binds RET to `crm-minibuffer-complete-and-exit'
and TAB to `crm-minibuffer-complete'." and TAB to `crm-minibuffer-complete'."
@ -574,7 +574,7 @@ The default value for the separator character is the value of
`crm-default-separator' (comma). The separator character may be `crm-default-separator' (comma). The separator character may be
changed by modifying the value of `crm-separator'. changed by modifying the value of `crm-separator'.
Continguous strings of non-separator-characters are referred to as Contiguous strings of non-separator-characters are referred to as
'elements'. In the aforementioned example, the elements are: 'alice', 'elements'. In the aforementioned example, the elements are: 'alice',
'bob', and 'eve'. 'bob', and 'eve'.
@ -590,9 +590,8 @@ INHERIT-INPUT-METHOD."
(let ((minibuffer-completion-table (function crm-collection-fn)) (let ((minibuffer-completion-table (function crm-collection-fn))
(minibuffer-completion-predicate predicate) (minibuffer-completion-predicate predicate)
;; see completing_read in src/minibuf.c ;; see completing_read in src/minibuf.c
(minibuffer-completion-confirm (if (eq require-match t) (minibuffer-completion-confirm
nil (unless (eq require-match t) require-match))
t))
(crm-completion-table table) (crm-completion-table table)
crm-last-exact-completion crm-last-exact-completion
crm-current-element crm-current-element
@ -600,30 +599,27 @@ INHERIT-INPUT-METHOD."
crm-right-of-element crm-right-of-element
crm-beginning-of-element crm-beginning-of-element
crm-end-of-element crm-end-of-element
map) (map (if require-match
(if require-match crm-local-must-match-map
;; use `crm-local-must-match-map' crm-local-completion-map)))
(setq map crm-local-must-match-map)
;; use `minibuffer-local-completion-map'
(setq map minibuffer-local-completion-map))
(split-string (read-from-minibuffer (split-string (read-from-minibuffer
prompt initial-input map prompt initial-input map
nil hist def inherit-input-method) nil hist def inherit-input-method)
crm-separator))) crm-separator)))
;; testing and debugging ;; testing and debugging
;;; (defun crm-init-test-environ () ;; (defun crm-init-test-environ ()
;;; "Set up some variables for testing." ;; "Set up some variables for testing."
;;; (interactive) ;; (interactive)
;;; (setq my-prompt "Prompt: ") ;; (setq my-prompt "Prompt: ")
;;; (setq my-table ;; (setq my-table
;;; '(("hi") ("there") ("man") ("may") ("mouth") ("ma") ;; '(("hi") ("there") ("man") ("may") ("mouth") ("ma")
;;; ("a") ("ab") ("abc") ("abd") ("abf") ("zab") ("acb") ;; ("a") ("ab") ("abc") ("abd") ("abf") ("zab") ("acb")
;;; ("da") ("dab") ("dabc") ("dabd") ("dabf") ("dzab") ("dacb") ;; ("da") ("dab") ("dabc") ("dabd") ("dabf") ("dzab") ("dacb")
;;; ("fda") ("fdab") ("fdabc") ("fdabd") ("fdabf") ("fdzab") ("fdacb") ;; ("fda") ("fdab") ("fdabc") ("fdabd") ("fdabf") ("fdzab") ("fdacb")
;;; ("gda") ("gdab") ("gdabc") ("gdabd") ("gdabf") ("gdzab") ("gdacb") ;; ("gda") ("gdab") ("gdabc") ("gdabd") ("gdabf") ("gdzab") ("gdacb")
;;; )) ;; ))
;;; (setq my-separator ",")) ;; (setq my-separator ","))
;(completing-read-multiple my-prompt my-table) ;(completing-read-multiple my-prompt my-table)
;(completing-read-multiple my-prompt my-table nil t) ;(completing-read-multiple my-prompt my-table nil t)