From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6036 invoked from network); 3 Aug 2000 07:12:18 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 3 Aug 2000 07:12:18 -0000 Received: (qmail 437 invoked by alias); 3 Aug 2000 07:11:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12493 Received: (qmail 427 invoked from network); 3 Aug 2000 07:11:50 -0000 Date: Thu, 3 Aug 2000 09:11:43 +0200 (MET DST) Message-Id: <200008030711.JAA12112@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Adam Spiers's message of Wed, 2 Aug 2000 16:01:31 +0100 Subject: Re: PATCH: completion caching layer Adam Spiers wrote: > ... > > > > I agree entirely. That way also I could make _perl_modules set a > > > default style (if one is not already set) when the function is loaded, > > > rather than each time it's invoked. But where would it appear in the > > > context? My knowledge of this stuff is slightly weak, I'm afraid. > > > > After the last colon: > > > > zstyle -t ":completion:${curcontext}:" ... > > ^here > > > > I.e., instead of the tag (if you would use tags). > > OK. Although that doesn't solve the problem of having to set a > default for each of the commands _perl_modules completes. Maybe > > zstyle ':completion:::::RPMs' cache-policy _rpms_caching_policy > > would work? For use by the completion function itself? We decided some time ago that they shouldn't set styles themselves, only look them up. So, instead of adding what you suggest (which most probably wouldn't work because there are other things in the context, e.g. the command name), one would use the return value of zstyle: zstyle -s ":completion:${curcontext}:RPMs" cache-policy foo || foo=_rpms_caching_policy I.e., the return value of zstyle is non-zero iff the style is not set for that context. > Incidentally I couldn't find anything in the documentation to explain > the difference between e.g. ::: and :*:*: in contexts. Did I miss it? Err. Pattern matching. `:::' matches only itself, `:*:*:' matches `::perl:' and `::perl:argument-rest' and `:complete:perl:argument-rest' and `predict:complete:perl:argument-rest'. The patterns given when defining styles are really only matched agains the context-strings given when looking up styles. Normal shell pattern matching, nothing special there. Only the sorting of the patterns is something not used elsewhere. Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de