From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14582 invoked from network); 11 Mar 2009 04:24:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) 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.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 11 Mar 2009 04:24:32 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 71019 invoked from network); 11 Mar 2009 04:22:48 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Mar 2009 04:22:48 -0000 Received: (qmail 5094 invoked by alias); 11 Mar 2009 04:22:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26713 Received: (qmail 5081 invoked from network); 11 Mar 2009 04:22:43 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 11 Mar 2009 04:22:43 -0000 Received: from vms173017pub.verizon.net (vms173017pub.verizon.net [206.46.173.17]) by bifrost.dotsrc.org (Postfix) with ESMTP id C193980307F8 for ; Wed, 11 Mar 2009 05:22:37 +0100 (CET) Received: from torch.brasslantern.com ([96.249.201.13]) by vms173017.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KGB00GXCQTBWNK4@vms173017.mailsrvcs.net> for zsh-workers@sunsite.dk; Tue, 10 Mar 2009 23:22:26 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id n2B4MLIx029101 for ; Tue, 10 Mar 2009 21:22:22 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id n2B4MLsT029100 for zsh-workers@sunsite.dk; Tue, 10 Mar 2009 21:22:21 -0700 From: Bart Schaefer Message-id: <090310212221.ZM29099@torch.brasslantern.com> Date: Tue, 10 Mar 2009 21:22:18 -0700 In-reply-to: <20090310135146.30c0c794@news01> Comments: In reply to Peter Stephenson "Re: setopt globcomplete and () broken" (Mar 10, 1:51pm) References: <237967ef0903100625s7e8e5908t7852ade0c1d6d8d3@mail.gmail.com> <20090310135146.30c0c794@news01> <20090310173424.1af302c5@news01> <237967ef0903101104y135e0ca6sdbd9fbe8272f2d99@mail.gmail.com> <200903101818.n2AIIIFk010993@news01.csr.com> <237967ef0903101130j64c71c88r9c8e234d000fc351@mail.gmail.com> In-reply-to: <20090310173424.1af302c5@news01> Comments: In reply to Peter Stephenson "Re: setopt globcomplete and () broken" (Mar 10, 5:34pm) In-reply-to: <237967ef0903101104y135e0ca6sdbd9fbe8272f2d99@mail.gmail.com> Comments: In reply to Mikael Magnusson "Re: setopt globcomplete and () broken" (Mar 10, 7:04pm) In-reply-to: <200903101818.n2AIIIFk010993@news01.csr.com> Comments: In reply to Peter Stephenson "Re: setopt globcomplete and () broken" (Mar 10, 6:18pm) In-reply-to: <237967ef0903101130j64c71c88r9c8e234d000fc351@mail.gmail.com> Comments: In reply to Mikael Magnusson "Re: setopt globcomplete and () broken" (Mar 10, 7:30pm) X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers Subject: Re: setopt globcomplete and () broken MIME-version: 1.0 Content-type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.92.1/9087/Wed Mar 11 04:09:54 2009 on bifrost X-Virus-Status: Clean There are two patch hunks in here, one all the way at the end. On Mar 10, 1:51pm, Peter Stephenson wrote: } Subject: Re: setopt globcomplete and () broken } } On Tue, 10 Mar 2009 14:25:16 +0100 } Mikael Magnusson wrote: } > % touch '()' '().' } > % touch } > % touch \(\) } > \(\) \(\). } > % setopt globcomplete } > % touch } > % touch \(\) } > # nothing appears } } The following chunk of code in guess-where around line 201 is triggering: } it's looking for glob qualifiers. We need a test that the parentheses } aren't quoted; we could have '()' or "()" or $'()' or \(\), or some } mixture, possibly with text in between. } } if [[ -n "$compstate[pattern_match]" && Note that this first test is true when globcomplete is set. The only other time it can be true is if we somehow come through here via one of _correct or _approximate (or someone's personal completer function that attempts something similar). } ( ( -z "$SUFFIX" && "$PREFIX" = (|*[^\$])\([^\|\~]##\) ) || } "$SUFFIX" = (|*[^\$])\([^\|\~]##\) ) ]]; then Except for the insanely complicated case where an (e:...:) qualifier has an expression with backslashes, which I'll bet this has never really handled anyway, I think the following may deal with it: Index: Completion/Unix/Type/_path_files =================================================================== diff -c -r1.20 _path_files --- _path_files 28 Feb 2009 07:13:24 -0000 1.20 +++ _path_files 11 Mar 2009 03:34:33 -0000 @@ -199,8 +199,8 @@ zstyle -s ":completion:${curcontext}:" ignore-parents ignpar if [[ -n "$compstate[pattern_match]" && - ( ( -z "$SUFFIX" && "$PREFIX" = (|*[^\$])\([^\|\~]##\) ) || - "$SUFFIX" = (|*[^\$])\([^\|\~]##\) ) ]]; then + ( ( -z "$SUFFIX" && "$PREFIX" = (|*[^\$])\([^\|\~\\]##\) ) || + "$SUFFIX" = (|*[^\$])\([^\|\~\\]##\) ) ]]; then # Copy all glob qualifiers from the line to # the patterns used when generating matches if [[ "$SUFFIX" = *\([^\|\~]##\) ]]; then I think that will cover the majority of cases, but let's explore the rathole PWS has gone down just a bit farther. On Mar 10, 5:34pm, Peter Stephenson wrote: } Subject: Re: setopt globcomplete and () broken } } On Tue, 10 Mar 2009 13:51:46 +0000 } Peter Stephenson wrote: } > elif [[ "$tmp1" = (#b)(*[^\$])(\(\([^\|~]##\)\)) ]]; then } > tmp2=( "$tmp2[@]" "${match[1]}((${tmp3}${match[2][3,-1]}" ) } } I thought I was on the way to understanding what was going on here, but } this attempt to match some form of glob qualifiers has stumped me. Why are } we specially matching a pattern ending with glob qualifiers wrapped in } double parentheses? That seems to be from zsh-workers/9191, and Sven wrote it that way right from the beginning. Note it used to be inside a test for whether the "sort" style was set; I haven't tracked down when that changed. } Can I simply hold my breath until it goes away? Or until Sven comes back, I suppose. On Mar 10, 7:04pm, Mikael Magnusson wrote: } Subject: Re: setopt globcomplete and () broken } } If I delete that whole paragraph of code, my completion works as I } want Not surprising, see my first remark about $compstate[pattern_match]. On Mar 10, 6:18pm, Peter Stephenson wrote: } Subject: Re: setopt globcomplete and () broken } } Mikael Magnusson wrote: } > And when completing actual files, why would globcomplete mean } > _path_files has to do extra work instead of just expanding the } > pattern? } } The extra work in this particular case is merging together glob } qualifiers passed down (e.g. "-/" becoming "*(-/)") with any that are } there on the command line. Right, but in this case there is no glob qualifier, just a real file name with parens in it. So what we really want to do is avoid that mess entirely, isn't it? Worrying about doubled parens is a tangent. On Mar 10, 7:30pm, Mikael Magnusson wrote: } Subject: Re: setopt globcomplete and () broken } } > Are you sure that's not going through _expand? If I remove _expand } > from the list of completers, I don't get completions for things like } > *zshe*(D) unless glob_complete is set. } } Well, as i wrote further down my completer list is _oldlist _complete } _correct, i don't know if that is a yes or a no :). It completes for me without _expand as well. The _complete_debug trace is too long and call _path_files too many times to work out exactly what the call sequence is, but it has something to do with the _match completer. } _path_files:25: command not found: _globflags } printed 5 or 6 times, if I run autoload _globflags it works. This } seems odd to me since _globquals seems to work without any special } treatment. The _globflags file in the source lacks a "#compdef" or "#autoload" line at the top. Index: Completion/Zsh/Type/_globflags =================================================================== retrieving revision 1.1 diff -c -r1.1 _globflags --- _globflags 23 Nov 2008 18:26:27 -0000 1.1 +++ _globflags 11 Mar 2009 04:21:01 -0000 @@ -1,3 +1,5 @@ +#autoload + local ret=1 local -a flags --