Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: PATCH: new-style completion for parameters and options
- X-seq: zsh-workers 5920
- From: "Andrej Borsenkow" <borsenkow.msk@xxxxxx>
- To: "Sven Wischnowsky" <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>, <zsh-workers@xxxxxxxxxxxxxx>
- Subject: RE: PATCH: new-style completion for parameters and options
- Date: Wed, 24 Mar 1999 14:15:23 +0300
- Importance: Normal
- In-reply-to: <199903231513.QAA19509@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
>
> As Andrej mentioned, this had some problems.
>
> Making typeset print `local' for local parameters was simple. I've
> made it be printed after the type since there may uses relying on
> things like `array' to be the first on the line. Thank god I don't
> have to decide if this is important/careful enough to be included in
> an official version. If not, most the rest of this patch is pretty
> useless.
>
> This adds the files `Core/_{{set_,unset_}options,parameters}' to be
> able to easily complete them. The ones for the options also use a `-M'
> option for this ignore-underscore-and-map-upper-to-lower-case thing.
>
Again I must beg your pardon for (partial) noice yesterday :-(
1. Parameter completion.
This does not solve the problem generally enough. First of all, if user has
existing compctl, this will be called (with the same problem); second, you
cannot prevent users from calling compgen -vANIOpZN directly (I am not sure,
if all of them has this problem)
What is the reason for compgen (and compctl) to complete non-local variables
at all? compctl never did it before (it simply could not be called in such a
context) - so there is no compatibility change related to completion. (The
only case is user-defined ZLE widgets, and they did not exist in 3.0.x)
For really perversed, compgen -v || compgen -k "something with typeset"
could be used :-) And I think, that typeset addition is still useful.
2. options completion
I was taken away by the fact, that old compctl examples did it the same way
you do in this patch:
###compctl -s '$(setopt 2>/dev/null)' + -o + -x 's[no]' -o -- unsetopt
###compctl -s '$(unsetopt)' + -o + -x 's[no]' -o -- setopt
so, I was accustomed to the fact, that only unset/set options are completed.
As it stands now, compgen -o completes *any* option (irrespectively of
wether they are set or not) and does *not* have the above problem at all.
So, this patch is probably an overkill ...
But the idea with assoc array for options is still nice ...
cheers
/andrej
Messages sorted by:
Reverse Date,
Date,
Thread,
Author