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

Re: Smarter matcher-list: skip previous sets



On May 19, 12:11am, Daniel Hahler wrote:
}
} I've noticed that my matcher-list setup causes a (possibly expensive)
} completion function to be called multiple times, although the input was
} not be changed by the matcher-list substitution.
} 
} I think it would be smart if these calls would be skipped in case the
} input has not changed (because it was all lower-case in the beginning).

Unfortunately the matcher-list is handled as a loop in the shell code in
_main_complete, which has no way to tell whether the "input" is or is not
"changed" by any particular matcher.  You're assuming an implementation
of matchers that doesn't (ahem) match what actually happens internally.

Matchers don't "change" the input in any way; they alter the comparison
of the input to the set of possible results, and each such comparison is
independent of those that preceded it.  The *output* may be changed based
on which elements of the result set are selected.

-- 
Barton E. Schaefer



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