Subject: bug#49931: 28.0.50; `choose-completion' submits incorrect string when minibuffer content changes after creation of the *Completions* buffer

From: Juri Linkov <[email-masked]>
Date: Tue, 05 Apr 2022 21:54:27 +0300

close 49931 29.0.50
thanks

>>>> 3. click on an existing valid completion in the *Completions* buffer,
>>>>    e.g. on “append”
>>
>> completion-base-position was set at step (1) to cover the empty text
>> after the prompt, so this empty text (which is now right in front of
>> "blabla") is replaced with "append" resulting in "appendblabla".
>>
>> Obviously, the result is not what we want.
>> Now sure how to change which part, tho.  Maybe instead of
>> completion-base-position we should store the prefix and suffix strings,
>> so when you select an entry from *Completions* we just clear the
>> minibuffer and replace it with (concat prefix selection suffix)?
>
> Now I tried this, and it works correctly.  But not sure how to make
> this change as backward-compatible as possible.  One variant
> would be to save '("prefix" "suffix") instead of '(10 11)
> in 'completion-base-position' but this might fail in some existing code.
>
> So maybe better to add a new variable 'completion-base-affixes'.
> Then whether to use 'completion-base-position'
> or 'completion-base-affixes' could be defined by the new user option
> 'completion-use-base-affixes'.

Now this patched is pushed to master, and the bug report is closed.