From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22213 invoked by alias); 3 May 2011 10:57:46 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29133 Received: (qmail 18338 invoked from network); 3 May 2011 10:57:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Tue, 3 May 2011 11:27:42 +0100 From: Peter Stephenson To: Subject: Re: How to do completion of toggle flag sequences separated by +/- Message-ID: <20110503112742.30ce4904@pwslap01u.europe.root.pri> In-Reply-To: References: <7965011ce0f14864142f9006d881bba9@ulrik.uio.no> <20110501171846.7ea9607f@pws-pc.ntlworld.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.8 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.103.11.49] X-Scanned-By: MailControl A_10_80_00 (www.mailcontrol.com) on 10.68.0.162 On Mon, 2 May 2011 11:16:06 +0200 Haakon Riiser wrote: > By the way: When defining sub-functions inside a completion > function, is it recommended to test for their existence before > defining them? E.g., > > (( $+functions[_ffmpeg_foo] )) || _ffmpeg_foo() { > ... > } > > I see this in a lot of completers included with zsh, and I assumed > it was done for performance reasons (although it seems strange that > the performance hit could be significant, considering that the code > is only executed once per TAB keypress). That's certainly normal, but I think it's less for performance reasons than to allow you to overrided _ffmpeg_foo (or whatever) in another file. Note that the (( ... )) expression is true even if _ffmpeg_foo is marked for autoload. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom