From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2089 invoked from network); 19 Feb 2008 08:29:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 Feb 2008 08:29:53 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 24695 invoked from network); 19 Feb 2008 08:29:48 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 Feb 2008 08:29:48 -0000 Received: (qmail 19303 invoked by alias); 19 Feb 2008 08:29:45 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24570 Received: (qmail 19283 invoked from network); 19 Feb 2008 08:29:44 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 19 Feb 2008 08:29:44 -0000 Received: from vms048pub.verizon.net (vms048pub.verizon.net [206.46.252.48]) by bifrost.dotsrc.org (Postfix) with ESMTP id B37EA8026E0B for ; Tue, 19 Feb 2008 09:29:40 +0100 (CET) Received: from torch.brasslantern.com ([71.121.18.67]) by vms048.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JWH0092Q8XEGG62@vms048.mailsrvcs.net> for zsh-workers@sunsite.dk; Tue, 19 Feb 2008 02:29:39 -0600 (CST) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id m1J8TbPR016245 for ; Tue, 19 Feb 2008 00:29:38 -0800 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id m1J8Ta8H016244 for zsh-workers@sunsite.dk; Tue, 19 Feb 2008 00:29:36 -0800 Date: Tue, 19 Feb 2008 00:29:35 -0800 From: Bart Schaefer Subject: Re: _approximate doesn't work In-reply-to: <080218013338.ZM15026@torch.brasslantern.com> To: zsh-workers@sunsite.dk Message-id: <080219002936.ZM16243@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <200802171925.m1HJPbE8009696@pws-pc.ntlworld.com> <080218013338.ZM15026@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: _approximate doesn't work" (Feb 18, 1:33am) X-Virus-Scanned: ClamAV 0.91.2/5886/Tue Feb 19 09:09:14 2008 on bifrost X-Virus-Status: Clean [Redirected to -workers] On Feb 18, 1:33am, Bart Schaefer wrote: } Subject: Re: _approximate doesn't work } } On Feb 17, 7:25pm, Peter Stephenson wrote: } } } } The problem is around this bit that's used if descriptions } } for the commands are needed (the verbose style is set and at least some } } commands have descriptions): } } } } for cmd in ${(@)commands[(I)$PREFIX*]}; do } [...] } } I can see that _path_commands is skipping this loop, indicating the } } expansion was empty. However, I can't see why this is happening. } } Hmm, I get } } : _path_commands:15:then then for; line=whatis: -s: unknown option I tweaked _path_commands to replace "whatis -s" with "apropos" and now I can reproduce the original failure. The problem is that at the line above in _path_commands, PREFIX is always "xsane_g" (using PWS's test) and never "(#a1)xsane_g". Looking through the output, PREFIX gets set by the replacement compadd created via _approximate -- but that doesn't happen until *inside* the call to _wanted, long after the test in _path_commands. So the solution is to remove the attempt by _path_commands to pre-filter on PREFIX, and instead simply pass the whole damned array through, as is done with "compadd -k commands" in the no-descriptions branch. However, I must say that I'm not all that thrilled with the whole idea behind _path_commands, now that I look at it. Caching or not, I don't really want the entire contents of the whatis database dumped into my shell. Consequently I'm quite happy at the moment that "whatis -s" does not work correctly on my system, and I'd respectfully ask that someone else undertake to add a much more specific ztyle than just (as currently used) "verbose", that must be set to enable this. Meanwhile, here's the simple patch to fix the prefix matching. Index: Completion/Unix/Type/_path_commands --- zsh-forge/current/Completion/Unix/Type/_path_commands 2007-08-19 16:04:10.000000000 -0700 +++ zsh-4.3/Completion/Unix/Type/_path_commands 2008-02-18 20:55:51.000000000 -0800 @@ -52,7 +52,7 @@ if [[ -n $need_desc ]]; then typeset -a dcmds descs cmds local desc cmd sep - for cmd in ${(@)commands[(I)$PREFIX*]}; do + for cmd in ${(k)commands}; do desc=$_command_descriptions[$cmd] if [[ -z $desc ]]; then cmds+=$cmd --