Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] _compdef: Use zsh/param instead of a glob.
- X-seq: zsh-workers 43335
- From: Matthew Martin <phy1729@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] _compdef: Use zsh/param instead of a glob.
- Date: Sun, 26 Aug 2018 20:09:38 -0500
- 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==
- In-reply-to: <20180826105404.31846-1-danielsh@tarpaulin.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180826105404.31846-1-danielsh@tarpaulin.shahaf.local2>
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' \
Messages sorted by:
Reverse Date,
Date,
Thread,
Author