On 2/23/2023 11:34 AM, Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > The way I see it, either we still have an inf-loop or your > (pcomplete-match "\\`--.*=" 0) condition is redundant. > > From what you say the inf-loop should only manifest if we match neither > > (pcomplete-match "^--\\([^= \t\n\f]*\\)\\'" 0) > > nor > > (pcomplete-match "\\`--.*=" 0) > > and indeed: > > tar --pot\ > > seems to hang. Ah, good point. Instead of '(pcomplete-match "\\`--.*=" 0)', I think we want to handle all args starting with "--", but not matching "^--\\([^= \t\n\f]*\\)\\'". The goal is to call 'pcomplete-here*' exactly once per option. I did this a slightly different way in the updated patch by moving all the "--" cases into a single place (likewise with the "-" options). I think this is easier to follow than before, and makes it more obvious that we're calling 'pcomplete-here*' the right number of times.