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

From: Daniel Mendler <[email-masked]>
Date: Sun, 1 May 2022 14:40:54 +0200

On 5/1/22 13:53, Lars Ingebrigtsen wrote:
> Anyway, I agree that it's unfortunate that completion destructively
> modifies the strings it's handed, and this has been discussed
> extensively over the years (and there's probably several bug reports
> open about that, although I can't find them now).
> 
> I don't remember why we're doing that, but I seem to vaguely recall that
> there's a reason...  Anybody?
> 
> We should (at least) document this in all the relevant functions.

No, documenting this is not sufficient. I agree that mutating is not
strictly speaking illegal as a side effect of completion--replace, but
unfortunate and bad API design.

But the bug report here is about an actual bug in
minibuffer-force-complete which relies on completion--replace. As a
consequence  completion candidate strings are *illegally mutated*. I
propose to fix such issues once and for all by removing the unfortunate
mutation in completion--replace.

A while ago I discussed about this with Stefan. I hope he can give more
background regarding the reasons for the current behavior.

Daniel