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

RE: PATCH: new-style completion for parameters and options



>
> 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