From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4530 invoked by alias); 11 Mar 2011 18:24:30 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15868 Received: (qmail 5189 invoked from network); 11 Mar 2011 18:24:27 -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: Fri, 11 Mar 2011 18:24:07 +0000 From: Peter Stephenson To: Zsh Users Subject: Re: possibly useful zsh_directory_name implementation Message-ID: <20110311182407.680d6afd@pwslap01u.europe.root.pri> In-Reply-To: References: <20110311104402.6a411b10@pwslap01u.europe.root.pri> <20110311162514.255fe6b6@pwslap01u.europe.root.pri> <20110311163325.2bc05b6b@pwslap01u.europe.root.pri> 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.71.0.134 On Fri, 11 Mar 2011 18:09:57 +0100 Mikael Magnusson wrote: > Can you really just call a bunch of completions in series and get a > useful result? The documentation still seems to imply running will > stop as soon as one hook returns 0 status. Completion of a set of possibilities is a completely different operation from turning one, unique, name into one, unique, directory. You don't know the first function to be called is the one that will produce the completion you want. If the user typed "p", does the user want "pigbreeder-ahab" from zsh_directory_name_farmers, or "proj:monty" from zsh_directory_name_projects? The order of the functions doesn't tell you. > More importantly, shouldn't you only run zsh_directory_name if that > function exists? As it is now, it will be run even if only the array > is defined. Yes, I'll fix that. > Also, why the mix of -n $foo and ${+foo}? Your $foo is looking for the presence of a function. I think ${+functions[...]} does work, it just happened not to be done that way and I didn't change it. Your ${+foo} is looking for a variable being set; that's not what -n $foo does, and although -n $foo does the right thing as far as completion is concerned, testing the presense of the variable is the right thing to avoid triggering the error message which should only pop up if there is no defined mechanism for expanding ~[...]. -- 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