Subject: Re: bug#76461: 31.0.50; CRM tries to insert candidate in prompt read-only zone

From: Dmitry Gutov <[email-masked]>
Date: Fri, 28 Feb 2025 03:46:15 +0200

On 27/02/2025 20:33, Juri Linkov wrote:
> Maybe Dmitry could confirm if this is the right fix
> for completing-read-multiple recently fixed in
> bug#48356 and bug#76010.

It seems okay, thanks. Though it depends on the prompt always being a 
field, and the only field in the minibuffer. I don't know if that will 
hold for ever, but it seems to be the case currently.

Here's a slightly different fix which seems to behave the same in the 
test scenario. I'm happy with whichever of the two you prefer.

diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el
index 676252ae126..a75ccd46f50 100644
--- a/lisp/emacs-lisp/crm.el
+++ b/lisp/emacs-lisp/crm.el
@@ -269,7 +269,9 @@ completing-read-multiple
            (setq-local completion-list-insert-choice-function
                        (lambda (_start _end choice)
                          (let* ((beg (save-excursion
-                                      (if (search-backward-regexp 
crm-separator nil t)
+                                      (if (search-backward-regexp 
crm-separator
+ 
(field-beginning)
+                                                                  t)
                                            (1+ (point))
                                          (minibuffer-prompt-end))))
                                 (end (save-excursion