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

Re: completion

On Jan 7, 2015 11:51 AM, "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx> wrote:
> The hardest part of the zstyle mechanism is grasping the "reverse pattern
match" lookup mechanism.  Your hypothetical assassination example is
inaccurate because you're applying the patterns in the wrong "direction".

Here's possibly a way to think about this.  Let's consider two applications
of patterns, globbing and zstyle.

Globbing starts with a search space full of very specific objects:
Individual file names.  You provide a general description (the pattern) and
globbing looks up all the specific objects.

Zstyle starts with an *empty* search space and a whole lot of very specific
*searches* (at least one for every possible word-on-the-command-line you
might want to complete).  These searches are called style contexts.  You
populate the search space with general descriptions of the style contexts
you care about, and zstyle looks up the single general description that
best fits a specific search.

This is why there are wildcards in the commands that set styles.  There are
no wildcards in the commands that test or look up styles.

"Show me the dogs in this park that are on a leash." You search the park
for dogs, there may be lots but it is an instantaneous finite number.

"All dogs in this park must be on a leash." You check every animal you see
entering the park to see if it is a dog and has a leash.  You have no idea
how many animals or leashes you may eventually find, but if the current
animal is a dog, you know it has to have a leash to be allowed in the park.

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