From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28092 invoked by alias); 1 Mar 2011 21:49:20 -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: 28836 Received: (qmail 20218 invoked from network); 1 Mar 2011 21:49:17 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at ntlworld.com designates 81.103.221.56 as permitted sender) Date: Tue, 1 Mar 2011 21:11:57 +0000 From: Peter Stephenson To: Zsh list Subject: Re: PATCH: zstyle to control completion of functions/parameters beginning with underscore Message-ID: <20110301211157.0bf72ae1@pws-pc.ntlworld.com> In-Reply-To: References: <1238890030-4683-1-git-send-email-ft@bewatermyfriend.org> <090404193718.ZM19801@torch.brasslantern.com> <20090405191304.1908fca8@pws-pc> <090405151115.ZM13159@torch.brasslantern.com> <20090406100929.505617e2@news01> <2d460de70905270930j681da6a5kf7848d67d89f0c69@mail.gmail.com> <20090527175941.3bbe2eba@news01> <2d460de70905280148iebfcegcb4143c33e510efd@mail.gmail.com> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.22.0; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=R50lirqlHffDPPkwUlkuVa99MrvKdVWo//yz83qex8g= c=1 sm=0 a=mxml5_mnVooA:10 a=kj9zAlcOel0A:10 a=0QhtZkFNAAAA:8 a=pGLkceISAAAA:8 a=NLZqzBF-AAAA:8 a=fOtmDFFEIchOqpGqRpkA:9 a=g2yg85-ueYSdKJndCx5HBLKXjVUA:4 a=CjuIK1q_8ugA:10 a=KLYB3oV4TgcA:10 a=MSl-tDqOz04A:10 a=_dQi-Dcv4p4A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 On Tue, 01 Mar 2011 15:39:55 -0500 Greg Klanderman wrote: > >>>>> On May 28, 2009 Richard Hartmann wrote: > > On Wed, May 27, 2009 at 21:12, Greg Klanderman wrote: > >> But in the same vein, what I really want is a way to configure the > >> behavior for functions, variables, etc. beginning with "_" to be like > >> filenames beginning with ".": completion should work if I have > >> explicitly typed the leading "_", but even substring matching should > >> not *generate* a leading "_". > > > I think this is a good explanation of what, imo, the final goal should be. > > What do you guys think of the patch below? I'm open to better names > for the zstyle.. I've tested it a fair amount locally. Looks good to me. I think you missed the following case... Index: Completion/Zsh/Type/_functions =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_functions,v retrieving revision 1.3 diff -p -u -r1.3 _functions --- Completion/Zsh/Type/_functions 8 Jun 2005 12:45:36 -0000 1.3 +++ Completion/Zsh/Type/_functions 1 Mar 2011 21:10:13 -0000 @@ -1,5 +1,15 @@ #compdef unfunction -local expl +local expl hide ffilt -_wanted functions expl 'shell function' compadd -k "$@" - functions +zstyle -s ":completion:${curcontext}:functions" hide-internal hide +case "${hide:-never}" in + no|false|never) + ffilt='';; + yes|true|always) + ffilt='[(I)[^_.]*]';; + auto|dtrt) + [[ $PREFIX = [_.]* ]] && ffilt='' || ffilt='[(I)[^_.]*]';; +esac + +_wanted functions expl 'shell function' compadd -k "$@" - "functions$ffilt" -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/