From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10659 invoked by alias); 6 Dec 2010 16:22:10 -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: 15622 Received: (qmail 12248 invoked from network); 6 Dec 2010 16:21:59 -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: Mon, 6 Dec 2010 16:21:44 +0000 From: Peter Stephenson To: Zsh Users Subject: Re: Using the same completion function for various commands Message-ID: <20101206162144.58d5b483@pwslap01u.europe.root.pri> In-Reply-To: <20101206161020.693f3f4a@pwslap01u.europe.root.pri> References: <201012061512.21791.mrichter@theory.phy.tu-dresden.de> <20101206151124.389fd287@pwslap01u.europe.root.pri> <20101206161020.693f3f4a@pwslap01u.europe.root.pri> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 06 Dec 2010 16:21:44.0626 (UTC) FILETIME=[AC5BE120:01CB9561] X-Scanned-By: MailControl A_10_80_00 (www.mailcontrol.com) on 10.71.0.131 On Mon, 6 Dec 2010 16:10:20 +0000 Peter Stephenson wrote: > On Mon, 6 Dec 2010 16:18:47 +0100 > Mikael Magnusson wrote: > > Ah, er, right. But. Is there any way to combine -p and saying > > foo=du ? When I tried compdef _du -p 'foo_*=du' nothing happened. Yes, I know, it *still* doesn't work, and you were about complain. Is the following change to _pick_variant right? Why we would ever prefer $words[1] to $service, when this seems to be what $service is for? Am I missing cases where you definitely don't want the basic service run in order to check a variant? Index: Completion/Base/Utility/_pick_variant =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_pick_variant,v retrieving revision 1.2 diff -p -u -r1.2 _pick_variant --- Completion/Base/Utility/_pick_variant 28 Feb 2009 07:11:31 -0000 1.2 +++ Completion/Base/Utility/_pick_variant 6 Dec 2010 16:18:54 -0000 @@ -7,7 +7,7 @@ local -A opts (( $+_cmd_variant )) || typeset -gA _cmd_variant zparseopts -D -A opts c: r: -: ${opts[-c]:=$words[1]} +: ${opts[-c]:=${service:-$words[1]}} while [[ $1 = *=* ]]; do var+=( "${1%%\=*}" "${1#*=}" ) -- 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