Subject: bug#64351: probabe bug associated with “completion-regexp-list”

From: Eli Zaretskii <[email-masked]>
Date: Fri, 30 Jun 2023 09:21:02 +0300

> From: Shynur Xie <[email-masked]>
> Date: Thu, 29 Jun 2023 18:53:28 +0000

(Please always state at least in which version of Emacs on what
platform did the problem occurred.  It is best to use the dedicated
command report-emacs-bug, which will collect the important details for
you.  This avoids the need to guess whether the issue is relevant to
Emacs 29 and trying several different versions to see if they
reproduce the problem.)

> Evaluate this:
> 
>     (setq completion-regexp-list '("^[^-]"))
> 
> Then type “C-h v -l TAB”, an error will be thrown.

Stefan, is the below the right fix?  If it is, do you think it is safe
enough for the release branch?

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 4aa1ab3..3e30b68 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -4027,7 +4027,8 @@ completion-pcm--merge-completions
               (setq ccs (nreverse ccs))
               (let* ((prefix (try-completion fixed comps))
                      (unique (or (and (eq prefix t) (setq prefix fixed))
-                                 (eq t (try-completion prefix comps)))))
+                                 (and (stringp prefix)
+                                      (eq t (try-completion prefix comps))))))
                 (unless (or (eq elem 'prefix)
                             (equal prefix ""))
                   (push prefix res))