Subject: Re: bug#24676: 25.1; `completion-pcm-all-completions' should not reverse order of candidates

From: Michael Heerdegen <[email-masked]>
Date: Mon, 17 Oct 2016 10:19:54 +0200

Hello,

> Because of this part, at the end of the function,
> `completion-pcm-all-completions' reverses the order of the candidates.
>
> (let ((poss ()))
>   (dolist (c compl)
>     (when (string-match-p regex c) (push c poss))) ; <==== reverses
>   poss)
>
> It should not do this.  Users should be able to depend on whatever order
> the candidates are already in (as returned by `all-completions').
>
> For example, for buffer candidates, the default order from
> `all-completions' is last-display-time order.
>
> The fix is trivial:
>
> (let ((poss ()))
>   (dolist (c compl)
>     (when (string-match-p regex c) (push c poss)))
>   (nreverse poss))

Ah, this is the reason for the candidate list reversion I see.  Yes,
this should IMO not happen.

Stefan, if you get the time, can you please have a look at whether the
suggested fix looks ok to you, and commit it if applicable?

Thanks,

Michael.