reddit / emacs

Completing read where initial input is returned when nothing matches?

pragmat1c1 · 2022-06-10 13:49
Is there a completing read package that can return the initial input of the user, if nothing is found in the list? \`ivy-read\` will return "Nothing found" when there is no match, but I need the initial input when there is no match. I need this to look up something, and create something new if there is no match in the previous lookup. ​
yyoncho · 2022-06-10 14:10
In `completing-read` (the function that you should use in general) there is `require-match` param.
pragmat1c1 · 2022-06-10 14:12
Thank you very much. So I'd use this: (setq abc-keywords '("touch" "touch_start" "touch_end" "for" "foreach" "forall" )) (completing-read "Tpye something: " abc-keywords nil 'confirm) `'confirm' is one value for the param `require-match`. Apparently this is not possible in `ivy-read`.
oantolin · 2022-06-12 16:27
Simple solution: use `completing-read` instead of `ivy-read`. :) Ivy users will still see thee Ivy interface and you make your code usable by non-users of Ivy too.