Zsh Mailing List Archive
Messages sorted by:
- X-seq: zsh-users 19706
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: completion
- Date: Wed, 07 Jan 2015 15:00:53 -0800
- In-reply-to: <CAH+w=7b9i6NdD3=5SJpiaHP5HsObAoNRYFJrvxV88Sf5DFCypg@mail.gmail.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <5488D414.firstname.lastname@example.org> <email@example.com> <5488F0AC.firstname.lastname@example.org> <141210214454.ZM12261@torch.brasslantern.com> <5489C8F4.email@example.com> <141211092824.ZM13349@torch.brasslantern.com> <5489F1BC.firstname.lastname@example.org> <20150107150109.GA14088@ypig.lip.ens-lyon.fr> <CAH+w=7YQ=VrWFjCXn4q7U48e3R+eNTF9xihHBf-oFDYTVR_zGQ@mail.gmail.com> <54AD8803.email@example.com> <CAH+w=7ZLc_8dYPL7sy_ESuvnZ-ob69nBAXM4_UeZzSdn_NSisw@mail.gmail.com> <CAH+w=7b9i6NdD3=5SJpiaHP5HsObAoNRYFJrvxV88Sf5DFCypg@mail.gmail.com>
On 01/07/2015 12:42 PM, Bart Schaefer wrote:
I see. One is 'go find' the other is 'test what comes by', so that's a
filter really, no? That's very helpful--get the bedrock concepts
right-- but how do we make sense of this in practice? How do we parse
these completions, with their varying numbers of colons and asterisks?
You and Peter have both made comments (which I don't understand) that
seem to suggest that these colons are not what I think they are at all.
But if they are not field separators then I can't imagine what they
might be. (For a while I thought they might be 'emphasizers'). I have
maybe a dozen or so of these 'zstyle' lines in my .zshrc, and they are
all there on faith (borrowed from here and there) and I have no idea how
any of them work. First, let me understand the meta syntax, then I'll
worry about what goes on inside each field (if that's what they are).
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.
So should we perhaps say 'zstyle filters' vs. 'zstyle searches'?
'Search' puts me in mind of the globbing thing: go find!
To put it in English, what I'm reaching for (I think), sounds something
If [something-on-command-line] matches [this-pattern] (a filter), then
expand that pattern using [this-particular-set-of-rules], and then
search (go find) in [this-particular-group-of-objects] for
[this-particular-glob-pattern] and put that on my command line. I'm
supposing that that's how it hasta work, but I can't 'see' that in the
Messages sorted by: