Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: zstyle to control completion of functions/parameters beginning with underscore
- X-seq: zsh-workers 28836
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: Zsh list <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: zstyle to control completion of functions/parameters beginning with underscore
- Date: Tue, 1 Mar 2011 21:11:57 +0000
- In-reply-to: <m3ei6qvalg.fsf_-_@klanderman.net>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- 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> <m37i02cqd9.fsf@klanderman.net> <2d460de70905280148iebfcegcb4143c33e510efd@mail.gmail.com> <m3ei6qvalg.fsf_-_@klanderman.net>
On Tue, 01 Mar 2011 15:39:55 -0500
Greg Klanderman <gak@xxxxxxxxxxxxxx> wrote:
> >>>>> On May 28, 2009 Richard Hartmann <richih.mailinglist@xxxxxxxxx> wrote:
> > On Wed, May 27, 2009 at 21:12, Greg Klanderman <gak@xxxxxxxxxxxxxx> 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 <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author