Subject: Re: bug#55205: 28.1.50; completion--replace illegally mutates completion candidates

From: Stefan Monnier <[email-masked]>
Date: Sun, 01 May 2022 14:34:34 -0400

Lars Ingebrigtsen [2022-05-01 19:48:16] wrote:
> Stefan Monnier <[email-masked]> writes:
>>> Is there no way to let the text properties survive completion?  Because
>>> that's also come up more than a few times.
>> Not sure what you mean by that.
>> I suspect that the details depend a lot on where the completion string
>> comes from.  Already the current code's check for
>> `minibuffer-allow-text-properties` seems too coarse since it is used
>> even when the completion is inserted into a normal buffer.
> I mean -- don't alter any of the strings the completion machinery is
> fed, but return them as is.

`completion-replace` doesn't return anything, it just inserts the
string, and as the comment explains, in a common use case that string it
receives includes things like the `completion-first` face which is out
of place at the destination, so there's clearly a need to remove some
properties sometimes.  How best to do that of course depends on which
other properties we might want to keep and when.

        Stefan