From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17193 invoked by alias); 24 Mar 2012 22:16:15 -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: 30376 Received: (qmail 8302 invoked from network); 24 Mar 2012 22:16:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.160.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=pnzzqRLHxIbZfaRDuagSFIcPxaS2P35Kn4lNT1ieY8Q=; b=UT1VQ5z4tecZaVMCgs9gP2P8jZQnLjut/+BTEp1BescsFajrVlULwqKnxGv5lWrE6g L0QQszpnNlGVKzuprPh7O2a4S9JgzGnYVyXEV+1Hw2wHNH/tDcfUTrOv56W0GGnVjeGp i1ZszZ0vjz+SkYbtFa9HwINjgEjMGl2SqPfbcj/4EsSCjLoSRIC9FoJVbSW86Z+yc08l 8eow1WmHKk5fGoxzT+Y8yToKfQLA/Rb163pwFvDsJzQexwJTcOPB6+Zdwpr10p17XyUh hzOrx6+3qcBLNKMnQ/X657SoSZCI5sNKdLTb2lJJS3Tj3Nc9zbxpYKASLA+absz4IOgP a2Pw== MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 24 Mar 2012 23:16:06 +0100 Message-ID: Subject: Re: [PATCH] Add _gradle for gradle and gradlew completion. From: Mikael Magnusson To: =?UTF-8?Q?Jesper_Nyg=C3=A5rds?= Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 24 March 2012 23:04, Jesper Nyg=C3=A5rds wrot= e: > 2012/3/24 Mikael Magnusson : >> You're defining a single function with the same name as the autoloaded >> function, and then calling it, that serves no purpose so you can just >> remove that indirection. > > Good call. I'll just remove it. > >> You could move the _gradle_caching_policy to >> the toplevel and then this pattern would make sense. (There's no >> namespaces for functions, so even though you define it inside _gradle >> now, it stays around after _gradle returns.) > > I did know that functions are global, but I must define the function > where I do, because I can only set it once I know what build file is > to be parsed, i.e. the $build_file is a local variable, but the > _gradle_caching_policy needs to know its value. In some other > languages, I would call this a closure. There is no such thing as closures in zsh, you can define it anywhere you want using a variable called $build_file and it will use the definition of the variable at the call site, not the definition site. Ie, the body of a function is completely ignored by zsh until you invoke the function (but the syntax has to be correct of course). >> zstyle -T ":completion:*:*:$service:*" gradle-inspect || gradle_inspect= =3Dno >> can probably be >> zstyle -b ":completion:*:*:$service:*" gradle-inspect gradle_inspect >> but I didn't test. :) > > Unless I misunderstand something, this doesn't seem to work as I'd > like it to. It works if the style is set, but I want the > gradle_inspect variable to default to be true if the gradle-inspect > style is unset, and this doesn't seem to happen with your suggestion. Okay, never mind that then :). >> You need to quote the ? in -?,-h,--help. (The completion system sets >> the nullglob option, so the whole argument just disappears without >> errors). > > Thanks, I had overlooked that one. > >> Other than that it looks pretty good to me. > > Great. I'll submit a new patch tomorrow, unless I have any other > errors pointed out by you or someone else. --=20 Mikael Magnusson