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.
completing-read
function. You can find that usingC-h f
. And, while typing thecompleting-read
form, the expected arguments are displayed in the echo area. Or do you mean something else? I am not sure what is your goal, but if you have only two options, you could also consider to use theuniversal argument
. – dalanicolai Jun 13 '22 at 22:31completing-read
I assume. – Dilna Jun 13 '22 at 23:05completing-read
, also not a shortcoming of the documentation. Just a limitation of our patience to read the function it's documentation :) – dalanicolai Jun 14 '22 at 06:03