zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: completion
Date: Wed, 07 Jan 2015 15:00:53 -0800	[thread overview]
Message-ID: <54ADBAA5.4080705@eastlink.ca> (raw)
In-Reply-To: <CAH+w=7b9i6NdD3=5SJpiaHP5HsObAoNRYFJrvxV88Sf5DFCypg@mail.gmail.com>

On 01/07/2015 12:42 PM, Bart Schaefer wrote:
> On Jan 7, 2015 11:51 AM, "Bart Schaefer" <schaefer@brasslantern.com> 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.
>
> Globbing:
> "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.
>
> Zstyle:
> "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.
>
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).

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 
like this:

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 
actual syntax.


  reply	other threads:[~2015-01-07 23:00 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 23:15 completion Ray Andrews
2014-12-10 23:31 ` completion Lawrence Velázquez
2014-12-11  0:34 ` completion Oliver Kiddle
2014-12-11  1:17   ` completion Ray Andrews
2014-12-11  5:44     ` completion Bart Schaefer
2014-12-11 16:40       ` completion Ray Andrews
2014-12-11 17:28         ` completion Bart Schaefer
2014-12-11 19:34           ` completion Ray Andrews
2015-01-07 15:01             ` completion Vincent Lefevre
2015-01-07 15:28               ` completion Peter Stephenson
2015-01-07 16:58                 ` completion Mikael Magnusson
2015-01-07 17:06                   ` completion Peter Stephenson
2015-01-07 18:33                   ` completion Ray Andrews
     [not found]                     ` <CAH+w=7Z_B2ghc21QgHxA8FEV7W8uQnjEwtPqK3tL-kjPihjicA@mail.gmail.com>
2015-01-07 19:54                       ` completion Bart Schaefer
2015-01-07 18:48               ` completion Bart Schaefer
2015-01-07 19:24                 ` completion Ray Andrews
2015-01-07 19:33                   ` completion Lawrence Velázquez
2015-01-07 20:06                     ` completion Ray Andrews
2015-01-07 19:51                   ` completion Bart Schaefer
2015-01-07 20:15                     ` completion Ray Andrews
2015-01-07 20:42                     ` completion Bart Schaefer
2015-01-07 23:00                       ` Ray Andrews [this message]
2015-01-08  5:09                         ` completion Bart Schaefer
2015-01-08  8:31                         ` completion Bart Schaefer
2015-01-08 16:52                           ` completion Ray Andrews
2015-01-08  0:43                 ` completion Vincent Lefevre
2015-01-08  0:57                   ` completion ZyX
2015-01-08  1:15                     ` completion Vincent Lefevre
2015-01-08  6:03                       ` completion Bart Schaefer
2015-01-08  5:26                   ` completion Bart Schaefer
2015-01-08 12:36                     ` completion Vincent Lefevre
2015-01-10  2:12                       ` completion Bart Schaefer
2015-01-12  9:09                         ` completion Vincent Lefevre
2015-01-12 16:43                           ` completion Bart Schaefer
2015-01-13 16:03                             ` completion Vincent Lefevre
2015-01-14  2:56                               ` completion Bart Schaefer
2015-01-08 17:12                     ` completion Ray Andrews
2015-01-09  9:37                       ` completion Vincent Lefevre
2015-01-10  5:33                       ` completion Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2012-12-03 17:44 completion Ray Andrews
2012-12-03 18:31 ` completion Ray Andrews
2007-05-15 15:27 Completion Anonymous bin ich
2007-05-15 16:23 ` Completion Peter Stephenson
2006-02-20 12:54 Completion Etienne Chové
2006-02-20 18:51 ` Completion Clint Adams
2006-02-20 19:47   ` Completion Etienne Chové
2003-12-22 23:15 Completion Seth Kurtzberg
2000-02-22 14:58 Completion Sven Wischnowsky
2000-02-22 14:47 Completion Sven Wischnowsky
2000-02-22 15:01 ` Completion Andy Spiegl
2000-02-22 11:36 Completion Sven Wischnowsky
2000-02-22 14:24 ` Completion Andy Spiegl
2000-02-22 18:01   ` Completion Bart Schaefer
2000-02-15  8:42 Completion Claus Alboege
2000-02-21 22:20 ` Completion Bart Schaefer
2000-02-22 10:37   ` Completion Andy Spiegl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54ADBAA5.4080705@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).