From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9780 invoked from network); 4 Nov 2004 18:39:47 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 4 Nov 2004 18:39:47 -0000 Received: (qmail 73377 invoked from network); 4 Nov 2004 18:39:41 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Nov 2004 18:39:41 -0000 Received: (qmail 28306 invoked by alias); 4 Nov 2004 18:39:33 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8174 Received: (qmail 28292 invoked from network); 4 Nov 2004 18:39:32 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 4 Nov 2004 18:39:32 -0000 Received: (qmail 72325 invoked from network); 4 Nov 2004 18:39:32 -0000 Received: from moonbase.zanshin.com (64.84.47.139) by a.mx.sunsite.dk with SMTP; 4 Nov 2004 18:39:30 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.13.1/8.13.1) with ESMTP id iA4IdT2X006102 for ; Thu, 4 Nov 2004 10:39:29 -0800 Date: Thu, 4 Nov 2004 10:39:29 -0800 (PST) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: Zsh User Subject: Re: dynamic reset of completion widget In-Reply-To: <20041104124224.GA9979@let.rug.nl> Message-ID: References: <20041104124224.GA9979@let.rug.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-0.0 required=6.0 tests=BAYES_44 autolearn=no version=2.63 X-Spam-Hits: -0.0 On Thu, 4 Nov 2004, Francisco Borges wrote: > I want to automatically create zsh widgets for python programs using > python's standard option parser framework (optparse) and I want also to > be able to make and set this widget on-the-fly. Seems to me the right way to do this would be to define _first to spot previously-unknown python scripts and hook them up. Calling _first is already supported in the completion system, but the default implementation is a no-op. E.g. _first() { local command=$words[1] if (( CURRENT > 1 )) && [[ -z $_comps[$command] ]]; then if [[ $command = *.py ]]; then eval "$($command --make-zsh-widget)" compdef _$command $command fi fi }