Subject: bug#59956: 29.0.60: Failure when completing arguments in Eshell after variable interpolation

From: Gregory Heytings <[email-masked]>
Date: Wed, 21 Dec 2022 09:28:43 +0000

>> Augusto and Jim, can you please try the attached patch and tell us if 
>> it fixes the issue without introducing regressions?
>
> It works for me after a bit of testing, thanks. I don't see any 
> regressions on the Eshell side of things, at least.
>

Thanks for your feedback!

>
> While it would be nice to have a way for Eshell to provide multiple 
> forms of its arguments for completion (one for external commands that 
> expect a flat list of strings, and another for Eshell commands), that 
> seems like a lot more work that would probably be better spent 
> elsewhere. (And a change like that would be too big for the release 
> branch anyway.)
>

Indeed.  There are two levels involved here: the pcomplete one and the 
eshell one.  The patch makes the pcomplete level more robust by ensuring 
that, even if pcomplete-parse-arguments-function does not return strings 
(which was an implicit assumption), pcomplete will continue to work.  On 
the eshell level, it would probably be better add a companion function to 
eshell-complete-parse-arguments (which is used for 
pcomplete-parse-arguments-function) that would return a proper string 
representation of the expanded arguments, and to use it for 
pcomplete-parse-arguments-function, instead of 
eshell-complete-parse-arguments.