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

Re: Per command _redirect completion

Sven wrote:

> - Does anyone know about other places than redirections and values
>   where this might be interesting to use? Even now it is already easy
>   to define more sets.

Contexts. They've always been mixed in with the commands but I think
it'd be logical to now separate them off (with the possible exception
of -default-). There wouldn't be much use for service and patterns with
them though so the value of separating them is questionable.

The only other places I can think of are arguments to math functions
and condition codes but they are probably best left until we need them
(I thought about adding a file size math function to the stat module so
it might be useful someday with that sort of thing).

> > Have I also understood correctly, that the compdef changes allow
> > multiple uses of -T so that _gzip might start with:
> >     #compdef gzip gunzip gzcat=gunzip -T values GZIP
> Right. Good? ;-)

Yes. Good.

Only I just wonder now: if we have to triplicate the list of commands
just to handle redirections (normal, < and >) it might end up being a
bit tedious.

> Felix Rosencrantz wrote:
> > Looks good to me.  Though am seeing an error with the value
completions.  While
> > the redirs and normal completion don't seem to have a problem. 
> > 
> > host@ TZ=<TAB>
> > _normal:74: division by zero
> > host@ DISPLAY=<TAB>
> > _normal:74: ':' without '?'
> > 
> >
> Yup, had this too, somtimes. Try the new and improved patch below...

Doesn't seem to be solved - `_do_type:31: ':' without '?'' after

And, f < <tab> is a bad math expression: operand expected at `<'

> +++ ./Completion/Base/Core/_normal	Wed Feb 27 22:29:17 2002

> +_set_command
> -return ret
> +_do_type "$skip[@]" comps "_$comp_command1" "_$comp_command2"

This last line needs the dollars and underscores swapped otherwise all
you get is service=_ and default completion.

> Only two small value-functions left.

And those aren't so small and could arguably live inside _gcc.

> > > diff -ur -r ../oz/Completion/Base/Utility/_contexts
> > > +# You may also select the assocs to use with the `-T assoc'
> > 
> > I know we only renamed it a year ago but _contexts perhaps could be
> > better named.
> Hm. I don't think it's too bad, but then I'm not a native English
> speaker.

It isn't particularly easy thinking of good names even when it is my
first language. My problem with the name _contexts is that it isn't
just a context (i.e. -parameter-, -equal- etc) that can be given to it
as an argument. It can be commands and now also values.

> The stuff in _normal has been put into separate function
> `_do_type', which needs a better name (for which I need help).
> Between the things to do:
> - Decide on a name for the concept so that we can give _do_type its
>   final name and update the docs.

How about _dispatch?

_contexts might then be _redispatch. Could they be merged as one
function? I can't see a reason why _contexts oughtn't to be honouring
pattern compdefs and they do basically the same job.



Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

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