From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8515 invoked by alias); 27 Aug 2018 01:09:45 -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: List-Unsubscribe: X-Seq: 43335 Received: (qmail 12737 invoked by uid 1010); 27 Aug 2018 01:09:45 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi0-f66.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.218.66):SA:0(-1.7/5.0):. Processed in 1.854495 secs); 27 Aug 2018 01:09:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: phy1729@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=fVx/bUsoDCC8bj4UQIupZizH/ysKnaKN8Q/gdLWWyyE=; b=PDBooNsOomNpy+RL2xDeFeMtYanljnPPjmpFO1xVrsIdAnm8GPNXp7cEJ4iT64nHzZ 2df8XNJt4vZshyBpC0FdXqbBIH5VebKxQoB8Md3qGL6K0yHFeRA2286B3XT+fjr3qz4M sY2o0jBTDW7JmbbddLFNqLo8IVMVsMaEGqwwgoXftYmSHFvgfSR+aFyVfek3fc+giM6p qq4sTBRAwhnCR96W0xtkjltNmZo7rwiGA8jtzOVEexTi3cd6LYGdAPFNO9VVuMmRbpzO nAa1dBFlNb9C0JwHuhg8z3uezEly6eJAFdqM1o++FdjLKcr8AMOnCGsMY9tGsSWN5/Iu FxIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=fVx/bUsoDCC8bj4UQIupZizH/ysKnaKN8Q/gdLWWyyE=; b=FU3dSll7LIV3Mb+q+KZrp7NSOUSl4clz8EaSBvi5mvYPUoYgPBfyGjqmINyKPcz+DZ YzVMrfBXhk7DgK8Qkwu2oxoO7yHzjHaJTXjMU/vkqa7lcEBpgBP584tVB2kAq4DMnQAf /1xxN9L6VAQG6mpixjblo4EpRMPsulDp/8LMzW9tpJzaJJ/ZzG3JLd1g3KTTNTnFdy+e 5ulm3uEqqB6lLY6ClXI1zDdBooAl+GxrBy+Au2QU7hUDKJG7zeI0LPUMBXthy/R9Oqzj 9/Wud4UDI0Cs1xBPy8tGcTId5sAEcOHme7sc7gAkX9vHNiliEl062NHZFWtG6oSdRvxx f8kg== X-Gm-Message-State: APzg51B34Urp0UN+aVGViYL1Z70xCEqkHnl2PPWa8iIexdTZadEhPc9Y 7jTBE+FVl5TfeH2OH39DPldYu0jro5o= X-Google-Smtp-Source: ANB0Vdak98VZbzFSNtHZL5erMEypC8C7DAABeUw795mA/Nj6rxI+WiX4faWWdNXraA6z4oy5w71aLA== X-Received: by 2002:aca:4083:: with SMTP id n125-v6mr9857568oia.167.1535332180808; Sun, 26 Aug 2018 18:09:40 -0700 (PDT) Date: Sun, 26 Aug 2018 20:09:38 -0500 From: Matthew Martin To: zsh-workers@zsh.org Subject: Re: [PATCH] _compdef: Use zsh/param instead of a glob. Message-ID: <20180827010937.GA61934@CptOrmolo.darkstar> Mail-Followup-To: zsh-workers@zsh.org References: <20180826105404.31846-1-danielsh@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180826105404.31846-1-danielsh@tarpaulin.shahaf.local2> User-Agent: Mutt/1.10.1 (2018-07-13) On Sun, Aug 26, 2018 at 10:54:04AM +0000, Daniel Shahaf wrote: > In particular, this allows functions defined inside another file to be > offered, such as various __git_foo() helpers defined in ${^fpath}/_git. I don't think this is a good idea at present. While the completion system does use the _ prefix namespace, I don't see anything in the documentation reserving the namespace to the completion system. There are already a number of projects[0] that use the _* namespace. Perhaps in 5.6 document that only completion functions should start with an underscore and then apply this patch for 5.7 so that users have time to adapt. - Matthew Martin 0: From the first page of searching zsh on github there's oh-my-zsh, pretzo, zsh-autosuggestions, and zsh-syntax-highlighting that use _ prefixed functions. > --- > Completion/Zsh/Command/_compdef | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/Completion/Zsh/Command/_compdef b/Completion/Zsh/Command/_compdef > index 7a64da835..003c37da3 100644 > --- a/Completion/Zsh/Command/_compdef > +++ b/Completion/Zsh/Command/_compdef > @@ -1,6 +1,6 @@ > #compdef compdef > > -local state line expl list disp curcontext="$curcontext" pat normal ret=1 > +local state line expl disp curcontext="$curcontext" pat normal ret=1 > local args1 args2 > typeset -A opt_args > > @@ -57,7 +57,8 @@ case $state in > _wanted commands expl 'completed command' compadd -k _comps && ret=0 > ;; > cfun) > - list=( ${^fpath:/.}/_(|*[^~])(:t) ) > + typeset -aU list=( ${(k)functions[(I)_*]} ) > + (( ${+list[1]} )) || list+=( ${^fpath:/.}/_(|*[^~])(:t) ) > if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then > disp=( ${list[@]#_} ) > _wanted functions expl 'completion function' \