Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bad math expression error inside _pick_variant when running insert-all-matches for ls

On Mon, Sep 28, 2020 at 10:52 AM lilydjwg <lilydjwg@xxxxxxxxx> wrote:
> I'm sorry I thought it came with zsh, but it turned out that I got it from a zsh-users message.

Wow.  That's from Andrej B. back in 1999/2000.  In fact I can't even
find the message that actually defines the function, just a couple of
the ones that discuss what it might do.

> This code has worked for me for a few years until today I noticed that it didn't work well with ls.

I can reproduce from zsh -f plus your function.  According to _main_complete:

# _precommand sets this to indicate we are following a precommand modifier
local -a precommands

I think the issue is that _insert_all_matches is expecting to be
called as a completer from inside _main_complete, not as a standalone

If we want _pick_variant to work in this context, we need PWS's patch,
but there may be other oddities as well.  Perhaps 20 years ago it was
OK to call _complete directly like that, but it's not OK any longer.

Messages sorted by: Reverse Date, Date, Thread, Author