Subject: Re: bug#61283: 29.0.60; pcomplete-completions-at-point loses text properties, breaking pcomplete-from-help annotations

From: Eli Zaretskii <[email-masked]>
Date: Thu, 18 May 2023 09:58:25 +0300

> Date: Wed, 17 May 2023 23:44:17 -0700
> Cc: [email-masked], [email-masked], [email-masked],
>  [email-masked]
> From: Jim Porter <[email-masked]>
> 
> > And why do we have to fix this in Emacs 29.1?  This only affects
> > Eshell, AFAIU, is that true?
> 
> It affects M-x shell for me too. Maybe I'm just doing something wrong 
> though. I tried this:
> 
>    emacs -Q -f shell
>    ls -<TAB>
> 
>  From that, I get completions like "--block-size=", which doesn't show 
> the annotation. With the annotation, it should be "--block-size=SIZE".
> 
> Currently, Pcomplete passes the annotation around by propertizing the 
> first character of the candidate string. That ends up not working, since 
> the completion code uses the characters in the buffer and concats the 
> suffix from Pcomplete. So then the pcomplete-annotation almost always 
> gets thrown out.
> 
> I think a safe (but incomplete) fix would be to put the annotation on 
> the *last* character of the candidate string. Then it usually wouldn't 
> get thrown out. It won't work in *every* case, but it would only fail in 
> rare edge cases.

Maybe that's better.

The other part of "safe" is whether completion--twq-all is called only
when these annotations are needed, or also in other cases.  If the
latter, which use cases the proposed change could affect?