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

Re: disable substring match on command name

On Mar 4,  4:34pm, Amm wrote:
} Umm, actually I am evaluating which solution would be faster?

Yours will probably be somewhat faster but not for the reasons you
worked out.  Looping over the completer list for each element of
matcher-list is going to far outweigh anything else in the process.
Removing the matcher-list style means that _main_complete calls
each function in the completer zstyle only once, then _description
takes just one shot at the matcher style during that iteration.

The advantage of the matcher-list is that you get to try each of the
listed matchers separately.  With the matcher style all combinations
are tried "at once"; in your example you have only one pattern in the
matcher style so this doesn't apply, but in general it may matter.

Hmm, my doc change said the matcher style is "tried before" the
matcher-list if both are used, but that's not quite right; it's tried
"at once" combined with each of the separate matcher-list patterns.
I believe it takes effect first, which may alter the result of the
later patterns but it doesn't stop them being applied.  Hmm.

} I am not sure how zstyle internally works but let me try.

The internal workings of zstyle don't make a lot of difference here,
unless you mean the internal workings of the matcher patterns, which
would depend on what you're completing rather than on which of these
methods you employed.

} (Also not sure if this belongs to users maillist or workers)

Users works fine.  We're not *that* picky unless a long thread about
C programming develops, or something like that.

} 4 = I dont know how expensive evaluate is, it is called every time.

There's a tiny bit of parsing overhead because the string to be eval'd
can't be pre-compiled, but unless you're going to iterate a very large
number of times that won't be signifcant.  Executing the command after
parsing is no more expensive than executing anything else.

} 7 = I dont know how expensive reply back is?

Same as any array assignment, it'll depend on how many elements are
being added to the array.  There's probably one extra array copy in
the case of the "nested" zstyles.

Barton E. Schaefer

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