Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: use _math for let; Completing parameters
- X-seq: zsh-workers 11293
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: use _math for let; Completing parameters
- Date: Wed, 10 May 2000 10:08:55 +0200 (MET DST)
- In-reply-to: Oliver Kiddle's message of Tue, 09 May 2000 18:13:24 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Oliver Kiddle wrote:
> One of the things which I would like to do in a few contexts when I am
> completing parameters is to either complete only parameters of a
> particular type or use a sort of tag-order (i.e. complete integers first
> and then any other parameter). _math for example would clearly benefit
> from only completing integer and float parameters. _parameters as it is
> currently doesn't lend itself to doing this with styles. What would be
> the best way to do this? What I was thinking of was to add an argument
> to _parameters (what option letters are safe? -t?) which could specify
> (as a pattern) those parameter types to complete. _parameters would use
> this in conjunction with anything specified by a user's zstyle
> configuration. How should I handle the zstyle defined type: I think the
> best way is to have it override any specified by the parameter to
> _parameters and warn people in the documentation not to use the style in
> a general context. How could this then work with a tag-order situation?
> The easy way in the completion function would be to call _parameters
> twice, the second time only if the first didn't find any matches but I
> can't see how this could combine with a user specified tag-order.
We could either do that in the way _files once worked, or, and I would
prefer that for better consistency, make it in the way _files now
works. I.e. add a style `param-patterns' (or `parameter-patterns'),
used as an array to override function-supplied patterns (with %p in
the value being replaced by that pattern). Etc. etc.
This is really looks like a more general problem (or opportunity
depending on which way you want to look at it). I know that I wished
for something like this in at least one other case, but I can't
remember where it was now...
So, maybe we should put this into a separate utility function
(_patterns or _multi_patterns or a better name) that gets the name of
a style, the function-supplied pattern(s) and the code to execute to
try for each match. If no such code is given, it could behave like
_tags, i.e. it is first called with the style and pattern and then
without arguments in a loop, returning zero when no more patterns are
to be tried. Or something like this.
Bye
Sven
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author