From: Mikael Magnusson <mikachu@gmail.com>
To: "Jesper Nygårds" <jesper.nygards@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH] Add _gradle for gradle and gradlew completion.
Date: Sat, 24 Mar 2012 23:16:06 +0100 [thread overview]
Message-ID: <CAHYJk3Q5MPE0bikf5uZo4MS+LKztzFF8we8xJHNoqDsjdDn1cA@mail.gmail.com> (raw)
In-Reply-To: <CABZhJg84WXDBPC61Z8e8aZUCHS7ixyYexkwwSXwHjN6i0Luvfw@mail.gmail.com>
On 24 March 2012 23:04, Jesper Nygårds <jesper.nygards@gmail.com> wrote:
> 2012/3/24 Mikael Magnusson <mikachu@gmail.com>:
>> 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=no
>> 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.
--
Mikael Magnusson
next prev parent reply other threads:[~2012-03-24 22:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-24 10:28 Jesper Nygårds
2012-03-24 10:39 ` Mikael Magnusson
2012-03-24 10:55 ` Jesper Nygårds
2012-03-24 11:14 ` Mikael Magnusson
[not found] ` <CABZhJg9xgaM7mr4dy8GYKHopAofnVRCzZmxfOsEca1VNugv6Cw@mail.gmail.com>
2012-03-24 22:04 ` Jesper Nygårds
2012-03-24 22:16 ` Mikael Magnusson [this message]
[not found] ` <CABZhJg_Aamsf57nhBFEvc0LX-pmOkrfRtGMccJo_Uwt=hoNQ6w@mail.gmail.com>
2012-03-25 14:23 ` Jesper Nygårds
2012-03-25 14:25 ` Jesper Nygårds
2012-03-25 14:51 ` Mikael Magnusson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHYJk3Q5MPE0bikf5uZo4MS+LKztzFF8we8xJHNoqDsjdDn1cA@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=jesper.nygards@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).