From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4769 invoked by alias); 8 Jan 2015 08:31:24 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19714 Received: (qmail 22264 invoked from network); 8 Jan 2015 08:31:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=Kc1larcG c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=YNv0rlydsVwA:10 a=HHme9TnnfLQ24sfVm2QA:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <150108003124.ZM8010@torch.brasslantern.com> Date: Thu, 08 Jan 2015 00:31:24 -0800 In-reply-to: <54ADBAA5.4080705@eastlink.ca> Comments: In reply to Ray Andrews "Re: completion" (Jan 7, 3:00pm) References: <5488D414.6010300@eastlink.ca> <30453.1418258082@thecus.kiddle.eu> <5488F0AC.2040901@eastlink.ca> <141210214454.ZM12261@torch.brasslantern.com> <5489C8F4.8030703@eastlink.ca> <141211092824.ZM13349@torch.brasslantern.com> <5489F1BC.5000900@eastlink.ca> <20150107150109.GA14088@ypig.lip.ens-lyon.fr> <54AD8803.4020704@eastlink.ca> <54ADBAA5.4080705@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: completion MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 7, 3:00pm, Ray Andrews wrote: } } 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. Incidentally, no, it's not like that at all. In fact its so far from that, that I can't even reword the above to give a better sense of it. Completion involves several layers of loops-within-loops, it can't be described in a single if-then sentence. If you ignore a lot of the looping parts and the listing of ambiguous matches, then it's sort of like: Choose a completer and pass it some information about the command line, from which it will construct a context which summarizes the meaning of the command line in about six words. For each/any configuration option that may be useful, use the context to find the best definition among the set of zstyle patterns the user has defined. Some of those options (called styles) should explain where to look for [this-particular-group- of-strings], otherwise use a fallback to find them. Compare whatever strings you end up with to the word to the left of or under the cursor and put the longest unambiguous common substring that matches on the command line, assuming the other styles said that's what you should do. If there aren't any matches at all, try again with the next completer until something is found or there are no more completers.