Subject: Re: bug#65137: 29.1; completion-substring-try-completion doesn't return the longest common substring

From: Stefan Monnier <[email-masked]>
Date: Tue, 29 Aug 2023 21:31:51 -0400

>   (completion-pcm--merge-completions '("ab" "ab") '(prefix "b"))
>   -> ("b")

Right this is a bug.

    (completion-pcm--merge-completions '("ab" "sab") '(prefix "b"))

returns (correctly)

    ("b" "a" prefix)

so

    (completion-pcm--merge-completions '("ab" "ab") '(prefix "b"))

should return either ("b" "a") or ("b" "a" prefix).

Could you accompany your patch of a regression test using
`completion-pcm--merge-completions` as above?

Similarly, I see that

    (completion-pcm--merge-completions '("abr" "absabr") '(prefix "br"))

returns

    ("br" prefix)

whereas it should arguably return

    ("br" "a" prefix)

[ Tho this may have the side effect that after this completion, `absabr`
  won't be considered any more, if the `basic` completion comes before
  `substring` :-(  ]

        Stefan