If you really mean use Convert
as the initial input then this is how:
(let* ((opts '("Convert" "Split"))
(sel (completing-read "Subset: " opts nil t "Convert")))
(message "SEL: %s" sel))
If you really mean use Convert
as the default value then this is how:
(let* ((opts '("Convert" "Split"))
(sel (completing-read "Subset: " opts nil t nil nil "Convert")))
(message "SEL: %s" sel))
If you really mean use Convert
as both the initial input and the default value then this is how:
(let* ((opts '("Convert" "Split"))
(sel (completing-read "Subset: " opts nil t "Convert" nil "Convert")))
(message "SEL: %s" sel))
In the initial-input (only) case Convert
is preinserted into the minibuffer, and the default, if you remove that preinserted input, is the empty string, ""
.
In the default (only) case Convert
is not inserted -- you use M-n
to insert it. And if you just RET
without inserting any text then you get Convert
.
In all three cases, just hitting RET
chooses Convert
. Convert
is an allowed completion because you decided that it belongs to opts
, which you pass as the allowed completions.
If you remove Convert
from opts
and change the t
value of arg REQUIRE-MATCH
to nil
, then Convert
isn't a completion but it is accepted as an input. Anything at all is accepted as an input, in this case.
It all depends on what you want. If you have a more specific question, please pose that separately.