Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: completion caching layer



Sven Wischnowsky (wischnow@xxxxxxxxxxxxxxxxxxxxxxx) wrote:
> 
> Adam Spiers wrote:
> 
> > Sven Wischnowsky (wischnow@xxxxxxxxxxxxxxxxxxxxxxx) wrote:
> > > It's a bit unfortunate that _cache_invalid can be called twice (in
> > > your examples), once directly and once from _retrieve_cache. I think.
> > 
> > Yes, I didn't like that either, but couldn't think of a better
> > design.  The problem is that there are actually two caching layers -
> > the parameters, and the cache files on disk, but the _cache_invalid
> > check needs to be invoked if either is about to be used.  Suggestions
> > for how to avoid this welcome.
> 
> Couldn't we stuff everything in _retrieve_cache? So that one only
> needs to call:
> 
>   if ! _retrieve_cache RPMs _rpms; then
>     _rpms=(...)
>     _store_cache RPMs _rpms
>   fi

I had thought of that, and then decided against it, probably for no
good reason whatsoever, as I was exhausted at the time :-) 

> > > About the lookup: I /think/ it would be more convenient if the type of 
> > > information cached would appear in the context, so that you could say
> > > `zstyle ":completion:*:rpms" cache-policy ...'. Haven't really played
> > > with it yet, though.
> > 
> > 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?

Incidentally I couldn't find anything in the documentation to explain
the difference between e.g. ::: and :*:*: in contexts.  Did I miss it?

> One problem is your
> naming scheme (upper-case) which is different from what we've used so
> far.

That's easily fixed...

I just noticed I forgot hunks for cache-policy.  Coming up in the next
patch ...



Messages sorted by: Reverse Date, Date, Thread, Author