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

From: Daniel Mendler <[email-masked]>
Date: Wed, 17 May 2023 08:31:18 +0200

On 5/17/23 07:45, Jim Porter wrote:
> I do have a mostly-complete patch for this though, but it's *certainly* 
> too complex for Emacs 29. The general strategy I'm using is to rely on 
> the fact that the completion list for 'try-completion', etc can be an 
> alist where the "keys" (i.e the CAR of each element of the main list) 
> are the strings to be completed. So then you can do something like:
> 
>    '(("foo" (pcomplete-annotation . "=bar"))
>      ;; ...
>      )
> 
> Then, in 'pcomplete-completions-at-point', I can get the annotations[1] 
> in the :annotation-function on the completion table that we return.
> 
> This is obviously a pretty invasive change and would require changing a 
> number of internal assumptions in Pcomplete (though I don't think it 
> would break the public API). If this sounds even remotely like a 
> reasonable way to go forward, I'll try to clean up my patch a bit more 
> and post it for feedback; it's currently a bit of a mess, I'm afraid...

Thank you. Carrying the annotation and echo information as part of an
alist seems like a good approach, since interference with the candidate
strings cannot lead to problems. Ideally the candidate strings would not
get modified like this by the `completion-table-with-quoting', but that
may be unavoidable given the nature of `completion-table-with-quoting'.
If the modification is too complex, Emacs 29 is of course not the right
place for it.

Daniel