unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55205: 28.1.50; completion--replace illegally mutates completion candidates
@ 2022-05-01  8:27 Daniel Mendler
  2022-05-01 11:53 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 57+ messages in thread
From: Daniel Mendler @ 2022-05-01  8:27 UTC (permalink / raw)
  To: 55205; +Cc: Stefan Monnier

The function completion--replace mutates the replacement string, it
strips the text properties. The command minibuffer-force-complete calls
(completion--replace base end (car all)) on the first candidate returned
by completion-all-sorted-completions, which then affects the candidate
strings passed to completing-read. The candidate strings passed to
completing-read should be treated as constant and should not be mutated.

There are two possibilities to fix this:

1. Copy the string (with concat or substring) before mutating it in
completion--replace. This is the preferred solution and will make
completion--replace safer to use.
2. Copy the candidate string just before passing it to
completion--replace. This is the approach I take for example in my Corfu
package and I will continue to do so for backward compatibility. Still,
the pattern is error prone and copying the candidate string is easily
forgotten, (completion--replace beg end (concat cand)).

Original downstream issue: https://github.com/minad/consult/issues/566

In GNU Emacs 28.1.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.16.0, Xaw scroll bars)
 of 2022-04-29 built on projects
Repository revision: 3b6338c8c351cce721f2f1aa115cadc401179d5c
Repository branch: emacs-28
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)





^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2022-05-04  8:51 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-01  8:27 bug#55205: 28.1.50; completion--replace illegally mutates completion candidates Daniel Mendler
2022-05-01 11:53 ` Lars Ingebrigtsen
2022-05-01 12:17   ` Eli Zaretskii
2022-05-01 20:11     ` Dmitry Gutov
2022-05-02  2:23       ` Eli Zaretskii
2022-05-02  9:46         ` Dmitry Gutov
2022-05-02 14:27           ` Eli Zaretskii
2022-05-02 21:06             ` Dmitry Gutov
2022-05-02 16:01     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-02 16:24       ` Eli Zaretskii
2022-05-02 16:34         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-02 16:38           ` Daniel Mendler
2022-05-02 16:47             ` Eli Zaretskii
2022-05-02 16:43           ` Eli Zaretskii
2022-05-02 16:48             ` Daniel Mendler
2022-05-02 16:53               ` Eli Zaretskii
2022-05-02 16:57                 ` Daniel Mendler
2022-05-02 17:53                   ` Eli Zaretskii
2022-05-02 18:35                     ` Daniel Mendler
2022-05-02 21:18                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-01 12:40   ` Daniel Mendler
2022-05-01 12:49     ` Eli Zaretskii
2022-05-01 12:54       ` Daniel Mendler
2022-05-01 13:16         ` Eli Zaretskii
2022-05-01 13:19           ` Daniel Mendler
2022-05-01 13:21             ` Daniel Mendler
2022-05-01 12:50     ` Daniel Mendler
2022-05-01 17:07   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-01 17:26     ` Lars Ingebrigtsen
2022-05-01 17:36       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-01 17:48         ` Lars Ingebrigtsen
2022-05-01 18:34           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-01 18:27       ` Daniel Mendler
2022-05-01 18:39         ` Lars Ingebrigtsen
2022-05-01 19:01           ` Daniel Mendler
2022-05-01 19:07             ` Lars Ingebrigtsen
2022-05-01 20:52               ` Dmitry Gutov
2022-05-01 20:54                 ` Lars Ingebrigtsen
2022-05-01 21:30                   ` Dmitry Gutov
2022-05-01 21:43                     ` Lars Ingebrigtsen
2022-05-02  6:31           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-02  8:11             ` Lars Ingebrigtsen
2022-05-02  9:00               ` Daniel Mendler
2022-05-02 12:23               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-03 10:13                 ` Lars Ingebrigtsen
2022-05-03 12:55                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-04  7:48                     ` Lars Ingebrigtsen
2022-05-04  8:24                       ` Daniel Mendler
2022-05-04  8:51                         ` Daniel Mendler
2022-05-02  8:49             ` Daniel Mendler
2022-05-02  9:04               ` Lars Ingebrigtsen
2022-05-02  9:57                 ` Daniel Mendler
2022-05-02 10:07                   ` Lars Ingebrigtsen
2022-05-02 10:17                     ` Daniel Mendler
2022-05-01 17:39     ` Eli Zaretskii
2022-05-01 18:06     ` Daniel Mendler
2022-05-02  0:34   ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).