Currently there is no way to submit an empty string when require-match is t. In default completing read you can submit an empty string which is sometimes used to determine the end of input. As an example see auto-insert command in emacs-lisp-mode. The prompt for the keywords repeats until the user submits the empty input. Currently there is no way to finish this input with selectrum.
To behave like the default interface selectrum shouldn't accept submitting a string which is not in the completion list but should allow submitting the empty string.
I'm hitting this bug too, here's a repro:
;; Run with `emacs -Q -l test.el'.
;;; Code:
;; Typical `straight.el' setup.
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; Insert repro code here:
(straight-use-package 'selectrum)
(selectrum-mode)
(auto-insert-mode)
Now C-x C-f foo.el RET y RET lisp RET RET ... stuck, can't escape
Ah, I found another thing that doesn't work well with this, vc-git-grep. The default value when it prompts for a file pattern isn't selected (although C-p let's me pull it up), and then when it queries for the directory, I can't select the current path in the prompt, it only lets me select children. I'm going to test your PR to see if this is fixed too...
(Ironic pattern of what's broken: built-in but perhaps slightly obscure Emacs functionality that most people seem to use "modern" packages to replace, but that I find useful!)
This should now be fixed!
@andschwa
The default value when it prompts for a file pattern isn't selected
Most helpful comment
This should now be fixed!