|
From: | Stefan Monnier |
Subject: | bug#55205: 28.1.50; completion--replace illegally mutates completion candidates |
Date: | Mon, 02 May 2022 17:18:47 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Eli Zaretskii [2022-05-02 19:53:08] wrote: > Why is it justified in this case? How is this case different from any > other case? I don't think it's different from any other. It's generally considered a bug when a function uses things like `sort`, `nconc, or `nreverse on a list it received as argument (unless the docstring explicitly mentions that the arg may be modified destructively). When a user reports this behavior as unexpected the answer is almost always to fix the funciton so it doesn't have this side-effect any more. The same usually holds for text properties on strings. The fact that `completion--replace` is a function used in the completion machinery was largely irrelevant to the decision of how to fix the problem. Its docstring says: "Replace the buffer text between BEG and END with NEWTEXT. Moves point to the end of the new text." and nowhere does it warn that NEWTEXT might be modified along the way, so removing properties on that string was just a plain and simple bug. Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |