Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: dynamic reset of completion widget
- X-seq: zsh-users 8177
- From: Peter Stephenson <pws@xxxxxxx>
- To: Francisco Borges <borges@xxxxxxxxxx>
- Subject: Re: dynamic reset of completion widget
- Date: Fri, 05 Nov 2004 12:11:52 +0000
- Cc: Zsh User <zsh-users@xxxxxxxxxx>
- In-reply-to: <20041104205400.GA12739@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20041104124224.GA9979@xxxxxxxxxx> <11332.1099573781@xxxxxxx> <20041104205400.GA12739@xxxxxxxxxx>
Francisco Borges wrote:
> > _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.
If _arguments doesn't change, you don't need to worry.
> 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=3D$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?
print $_comps[foo.py] will tell you what function the system will call
to handle foo.py.
Try adding
print "$bar $_comps[$bar]" >/tmp/optparse.dbg
after the compdef to see what's going on.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author