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

Re: compctl -Tx 'w[0,...] ...' ...



"Bart Schaefer" wrote:

> ...
> 
> What I want is a completion that applies to *all* commands, as do -D and
> -T, but that is triggered *after* any other completion provided for any
> specific command.  I guess I could get the effect by altering every other
> completion I ever define to end with the "continue using default" switch;
> but that means keeping my own edited copies of all the examples from the
> zsh dist, etc.
> 

(That's what I meant.)

After implementing the `+' style completion and using it for some time
I was thinking about adding a option for automatically using `-D'
completion if everything failed. But then Bas described how he got
used to using `+' at the end of almost all his compctls and noone
really complained about missing such a feature. It was quite easy to
implement (and I even had it in one of my private version), but it was
the time when many people were saying things like `let's keep zsh
small, no more options, ...', so I hesitated to suggest it.

>
> ... (using pattern matching to select a compctl) ...
> 
> I'm pretty sure I requested it myself ... an example would be to set up a
> compctl so that every command matching `x*' would accept the standard X
> toolkit completions (-display, -xrm, etc.).  The reason it might be hard
> is because you could end up with multiple different compctl lines that
> match the same command:
> 
> compctl -k '(-display -geometry -xrm)' x*
> compctl -k hosts xhosts
> 
> How would the ambiguity be resolved?
> 

(Maybe your request just failed to wake me up...)

Still I think it wouldn't be too hard to implement. The code already
has some `if no matches found, try again with...' in it. So the above
would turn into: try to find the command name in the compctl
hashtable, if it can't be found, just look at all hashtable entries
(optimised to use only entries with patterns, determined at definition
time), see if they match the current command name and if they do, try
them to produce matches. This could also be used to try multiple
pattern-compctls until one produces matches, whereas the `-Tx W[..]'
thing would only use the flags of the first matching `W[...]'.
One problem may be that the compctls are (of course) in no particular
order...


Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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