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

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

Here is a short recipe you can try with emacs -Q.

;; 1. Turn on fido
(fido-vertical-mode)

;; 2. Define some candidates with text properties
(defvar candidates
  (list (propertize "Emacs" 'face 'success)
        (propertize "Vim" 'face 'error)))

;; 3. Run completing-read and RET immediately (select Emacs)
;; RET invokes icomplete-fido-ret
;; -> icomplete-force-complete-and-exit
;; -> minibuffer-force-complete-and-exit
;; -> completion--complete-and-exit
;; -> completion--replace (the mutation happens there)
(completing-read "Make your choice: " candidates)

;; 4. Inspect the candidates, face of the selected candidate is lost
candidates