Subject: Re: bug#52169: 28.0.60; "Args out of range" when completing shell command

From: Stefan Monnier <[email-masked]>
Date: Sat, 04 Dec 2021 00:09:09 -0500

>> $ emacs -Q
>> M-! ./nosuchcommand C-b TAB
>>
>> - In Emacs 27.1, this simply says "[No match]".
>> - In Emacs 28.0.60, this errors out:
>>
>> > completion--some: Args out of range: "./nosuchcomma", 0, 14

Yuck!

This is one of those cases where the mismatch between the assumptions of
pcomplete and the featureset of minibuffer.el clash: `pcomplete-stub`
tells us we're completing "./nosuchcommand" but without telling us where
that string comes from in the buffer, so we fail to find
"./nosuchcommand" just before point (because the "d" is *after* point)
and thus fall back on the worst-case handler which doesn't behave well
at all here.

I pushed to `master` a fix for the immediate cause of the `Args out of
range` error, which seems to brings us back to Emacs-27's poor behavior.

Maybe it's good enough for `emacs-28` as well, but I have to think about
this problem a bit more.

        Stefan