From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24650 invoked from network); 2 Oct 2002 08:16:40 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 2 Oct 2002 08:16:39 -0000 Received: (qmail 21125 invoked by alias); 2 Oct 2002 08:16:16 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5409 Received: (qmail 21109 invoked from network); 2 Oct 2002 08:16:14 -0000 From: Borzenkov Andrey To: "'Jonas Juselius'" , zsh-users@sunsite.dk Subject: RE: zstyle problems Date: Wed, 2 Oct 2002 12:16:08 +0400 Message-ID: <6134254DE87BD411908B00A0C99B044F03A0B464@mowd019a.mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: <20021002075023.GA802@chem.helsinki.fi> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 > but I still think this is a bit confusing. Typing 'cd' and then > pressing ^Xh says 'tags in context :completion::complete:cd::', which > made me think that this was the actual context... That is correct for the time when actual completion for cd is done. But completion is a hierarchical process, and it looks up styles at different steps, so in early stage some information is not yet available. When completion starts, it knows only - it is completion :-) - actual command line contents - whether it has been called as default, context sensitive, completion or explicitly as special completion widget. So at this stage it can just fill in the first two fields, notably :completion: : ^ ^ | + default completion (for a widget here is a widget name) + completion (as opposed to e.g. styles for zftp function sybsystem) The first step it does at this point (after some initialization) is to decide what completer to use. It is completer that actually generates matches. Because the above is the only available information, completion looks up completer(s) using the context :completion:::::, for a complete-history widget this would be (probably) :completion:history-complete::::. Then completer fills in next part of context, then it decides if we are completing command, parameter etc and fills in next part of context etc. I too wish it is better described in manuals. At least, those cases when styles are looked up using non-standard context definitely must be made clear. Unfortunately, most examples overuse wildcards thus hiding this. > What would be the > correct way of defining different (individual) completions for 'cd' and > other > commands? > Mostly it is what you have done. For cd context is :completion::complete:cd:: with optional specific tag names appended. For completion based on _arguments you may add argument-N or option-N as last part to modify completion for specific options/arguments. You may also use :completion:*:... for both default context sensitive completion and completion widgets. -andrey