From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17034 invoked by alias); 9 Mar 2011 18:50:30 -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: 28874 Received: (qmail 8957 invoked from network); 9 Mar 2011 18:50:26 -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: none (ns1.primenet.com.au: domain at klanderman.net does not designate permitted sender hosts) From: Greg Klanderman To: zsh-workers@zsh.org Subject: Re: PATCH: zstyle to control completion of functions/parameters beginning with underscore Reply-To: gak@klanderman.net Date: Wed, 09 Mar 2011 13:41:48 -0500 In-Reply-To: <110306140249.ZM8874@torch.brasslantern.com> (Bart Schaefer's message of "Sun, 06 Mar 2011 14:02:49 -0800") Message-ID: User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.17 (linux) 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> <7658.1299027908@thecus> <110302153027.ZM10605@torch.brasslantern.com> <110303085435.ZM12072@torch.brasslantern.com> <110306140249.ZM8874@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >>>>> On March 6, 2011 Bart Schaefer wrote: > It's fine. Well, maybe not :-( I've noticed some bugginess with this: | zsh -f | phl% autoload -U compinit | phl% compinit -u | phl% function foobar () { echo foobar } OK, now hit to complete after 'foobar': | phl% foobar and it adds a space. now, | phl% zstyle ':completion:*' prefix-needed true and try completing 'foobar' again: | phl% foobar and it just beeps. If I change _command_names to instead declare a local 'funcnames' and change the prefix-needed logic to: | if zstyle -t ":completion:${curcontext}:functions" prefix-needed && \ | [[ $PREFIX != [_.]* ]] ; then | funcnames=(${(k)functions[(I)[^_.]*]}) | else | funcnames=(${(k)functions}) | fi and change the compadd in defs for functions to 'compadd -a funcnames', then it works fine. Completion of 'foobar' after 'unfunction' (i.e. using the equivalent change made to _functions) however works fine. So it seems like compadd's handling of the -k with subscript is not always working properly. My parameter completion change seems to be unaffected; which makes sense since it's directly adding the completions to the compadd invocation. thanks, Greg