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

From: Thierry Volpiatto <[email-masked]>
Date: Tue, 25 Feb 2025 06:37:03 +0000

Thierry Volpiatto <[email-masked]> writes:

> Thierry Volpiatto <[email-masked]> writes:
>
> This bug happens as well on 30.1, I am closing bug#76520 (useless
> duplicate).
> I modified the patch (only commit message)

Seems it is cleaner to write it like this:

--8<---------------cut here---------------start------------->8---
    (if (and (re-search-backward crm-separator nil t)
             ;; Matches end of prompt (:) when sep is ":".
             (not (field-at-pos (point))))
        (1+ (point))
      (minibuffer-prompt-end))
--8<---------------cut here---------------end--------------->8---

Have a look.

Here a test to reproduce:

--8<---------------cut here---------------start------------->8---
    (defun crm-init-test-environ ()
      "Set up some variables for testing."
      (interactive)
      (setq my-prompt "Prompt: ")
      (setq my-table
            '(("hi") ("there") ("man") ("may") ("mouth") ("ma")
              ("a") ("ab") ("abc") ("abd") ("abf") ("zab") ("acb")
              ("da") ("dab") ("dabc") ("dabd") ("dabf") ("dzab") ("dacb")
              ("fda") ("fdab") ("fdabc") ("fdabd") ("fdabf") ("fdzab") ("fdacb")
              ("gda") ("gdab") ("gdabc") ("gdabd") ("gdabf") ("gdzab") ("gdacb"))))
    (crm-init-test-environ)

    (let ((crm-separator "[ \t]*:[ \t]*")) 
      (completing-read-multiple my-prompt my-table))
--8<---------------cut here---------------end--------------->8---

-- 
Thierry