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

Re: dynamic reset of completion widget



» On Thu, Nov 04, 2004 at 01:09:41PM +0000, Peter Stephenson wrote:

> You might want to make it a bit more flexible about possible
> enchancements by providing a few extra support functions in parallel to
> _optparse (just put #autoload at the top of each function) and then make
> _foo.py use those.  It gives you a little bit more decoupling between
> the versions of zsh and the versions of the python script.  It depends
> how complicated _foo.py is going to be; if you're simply going to call
> _arguments, for example, maybe there's no point.  However, having your
> own _optparse_arguments as a front-end whose initial implementation is
> simply
> 
> _optparse_arguments() { _arguments "$@"; }
> 
> allows you a bit of future-proofing.

Hum, I can't say I understood what you meant to say here. What I can
tell you is that so far, I'm only using _arguments. 

> $service ought to give you this immediately.  In general it's

It did, thanks :-)

I have another problem, everytime I complete on foo.py, everything seems
to go fine but _optparse is still the widget used to complete the
script, e.g. the python script is called everytime I need to complete.

So I guess I'm not actually rebinding... The function I'm using is:

Any hints on how to get this right?

#autoload
_optparse(){

    bar=$service
    eval "`$bar --optcomp-on-the-fly`"

    if [[ -z $functions[_$bar] ]]; then
    _message "$bar --optcomp-on-the-fly didn't define _$bar"
    return 1
    fi

    compdef _$bar $bar
    _$bar "$@"
}

BTW, how can I see which widget is being used to complete a command? 

Peace,
-- 
Francisco Borges
Alfa Informatica - RuG



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