zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: use _math for let; Completing parameters
@ 2000-05-10  8:08 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 2000-05-10  8:08 UTC (permalink / raw)
  To: zsh-workers


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@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

* PATCH: use _math for let; Completing parameters
@ 2000-05-09 17:13 Oliver Kiddle
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Kiddle @ 2000-05-09 17:13 UTC (permalink / raw)
  To: Zsh workers

The patch makes _math be used for the let builtin.

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.

Oliver

Index: Completion/Base/_math
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_math,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 _math
--- Completion/Base/_math       2000/03/23 04:19:26     1.1.1.7
+++ Completion/Base/_math       2000/05/09 17:10:35
@@ -1,4 +1,4 @@
-#compdef -math-
+#compdef -math- let

 if [[ "$PREFIX" = *[^a-zA-Z0-9_]* ]]; then
   IPREFIX="$IPREFIX${PREFIX%%[a-zA-Z0-9_]#}"


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-05-10  8:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-10  8:08 PATCH: use _math for let; Completing parameters Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2000-05-09 17:13 Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).