Subject: Re: 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:15:54 +0200

On 5/16/23 23:37, Gregory Heytings wrote:
>> I just tried again and it seems the annotations work only in Shell but 
>> not in Eshell. This is probably the reason why the issue was missed. In 
>> Eshell the functionality never worked as intended after it got 
>> installed. I didn't mean to exaggerate.
>>
> 
> Yet ISTM that claiming that "the pcomplete help functionality never worked 
> properly" is an exaggeration.  The feature is 'pcomplete-from-help', which 
> extracts completion candidates from --help outputs, and is works (or 
> mostly works).  A subfeature of that feature are the annotations, and 
> these annotations do not work in one particular case, eshell.

Why does it matter? For me the feature never worked in the one single
use case relevant to me, namely Eshell. Calling this a "subfeature" can
then be considered an exaggeration as well - the purpose of
pcomplete-from-help is to provide annotations and documentation in the
echo area via :company-docsig. If this "subfeature" doesn't work, the
feature doesn't work.

I had experimented before with different approaches to generate help
information. There exists the package pcmpl-args
(https://elpa.nongnu.org/nongnu/pcmpl-args.html) which works in both
Shell and Eshell and I had hoped that the new pcomplete-from-help
feature would replace that in a clean way.

However there is another small difference between pcmpl-args and
pcomplete-from-help. pcmpl-args also shows the help text as part of the
annotation and not in the echo area. Augusto told me that he considers
such a long annotation text as default as too intrusive. Maybe the
annotation formatting could be configured to include either the only the
option value (the [VALUE] of --option=[VALUE]) or both the value and the
help text. Another alternative is to use some mechanism which translates
:company-docsig to an :annotation-function. This could either be done by
wrapping the Capf or on the level of the completion UI.

Daniel