From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4189 invoked from network); 30 Jun 2008 23:14:17 -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; 30 Jun 2008 23:14:17 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 90413 invoked from network); 30 Jun 2008 23:00:36 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 30 Jun 2008 23:00:36 -0000 Received: (qmail 3325 invoked by alias); 30 Jun 2008 20:53:08 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25258 Received: (qmail 6697 invoked from network); 30 Jun 2008 20:35:52 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 30 Jun 2008 20:35:52 -0000 Received: from mtaout01-winn.ispmail.ntl.com (mtaout01-winn.ispmail.ntl.com [81.103.221.47]) by bifrost.dotsrc.org (Postfix) with ESMTP id DB70C80524FA for ; Mon, 30 Jun 2008 22:35:48 +0200 (CEST) Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20080630204024.NPID28496.mtaout01-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Mon, 30 Jun 2008 21:40:24 +0100 Received: from pws-pc ([81.107.40.67]) by aamtaout02-winn.ispmail.ntl.com with ESMTP id <20080630203907.XEDE29365.aamtaout02-winn.ispmail.ntl.com@pws-pc>; Mon, 30 Jun 2008 21:39:07 +0100 Date: Mon, 30 Jun 2008 21:35:22 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Cc: 486785@bugs.debian.org Subject: Re: Bug#486785: tab completion broken Message-ID: <20080630213522.5fe843de@pws-pc> In-Reply-To: <20080622232342.756e9d4b@pws-pc> References: <20080619211539.GA5218@scru.org> <20080622232342.756e9d4b@pws-pc> X-Mailer: Claws Mail 3.4.0 (GTK+ 2.12.10; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.92.1/7591/Mon Jun 30 21:21:43 2008 on bifrost X-Virus-Status: Clean On Sun, 22 Jun 2008 23:23:42 +0100 Peter Stephenson wrote: > On Thu, 19 Jun 2008 21:15:39 +0000 > Clint Adams wrote: > > Using only the following zshrc, ls /tmp/.X2 results in the entire > > argument being elided (/tmp/.X* exists but /tmp/.X2* does not). > > > > --8<--zshrc--8<-- > > autoload -U compinit > > compinit > > > > zstyle ':completion:*' completer _approximate > > > > --8<--zshrc--8<-- > > It's something to do with using the -U argument to compadd when you've > got ambiguous completions: it works fine when there's only a single > completion. It was triggered by adding the -U's to do approximation in > non-final path segments (even before the compmatch change). Slight cop out, but the "-M " option is not documented as doing anything useful with the -U option and removing that wherever it occurs together with -U makes it better. (In case you're worried, this is not the matcher from the matcher list, which is passed down to compfiles earlier on to generate the list of trial completions rather than to compadd; the matcher here appears to be some kind of "it works better that way" kludge, I think to help path completion by allowing anything that matches completions of partial path prefixes.) Strictly I think the -M argument should be ignored, and it isn't, which is probably a bug, but I don't have time to investigate bugs that can be easily worked around, and I think given the -U the new code is more correct anyway. I've only removed the -M where there is a -U option. This improves things to the point where the unambiguous prefix is kept and the trial completions are available. I think the main difference in my own set-up was having menucomplete set, but my experiences are a bit ambiguous. I'm now a little worried it should be going into menu completion at this point even without the option being set; the documentation for _approximate says "the completer will normally start menu completion" but in the test case above it doesn't. I'm not clear how it starts menu completion, since _approximate only mentions menu completion in a comment at the top, implying it is done somewhere within that function that I can't find. If someone who doesn't usually have menu completion set can confirm that it's still not doing the right thing, I will see if I can find any further clues to how this should be happening. I couldn't find anything this change broke and I don't think it's supposed to have any negative effect. The reason this happens with _approximate, by the way, seems to be due to addition of the default completion: compadd -V -default- -U -Q - /tmp/.X2 to the array of normal matches (despite the fact there is no -M argument here---possibly the discrepancy between the two is confusing it). I traced the bug down to the function (assuming you've got /tmp/.X2 on the command line---the tmp1 contents aren't important, they're just what I happen to have): local -a tmp1 tmp1=( .X0-lock .X11-unix .Xfoo ) compadd -J -default- -U -Qf -J -default- -p /tmp/ -s '' \ -W /tmp/ -M 'r:|/=* r:|=*' -a tmp1 compadd -V -default- -U -Q - /tmp/.X2 However, I don't think that helps us with the remaining problem because that extra compadd can't explain how we get into menu completion. (I have kept this mail short by expunging phrases like "in an obscure fashion" and "undocumented" and "incomprehensible", as well as sarcastic asides like "of course" and "as I'm sure you'd guessed", and long-suffering comments like "spending weeks of my life", from wherever they naturally occur. You can have fun reinserting them. You can have even more fun writing a lex programme to fill out a completion system bug fix posting with the appropriate comments.) Index: Completion/Unix/Type/_path_files =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v retrieving revision 1.31 diff -u -r1.31 _path_files --- Completion/Unix/Type/_path_files 21 Jun 2008 21:36:01 -0000 1.31 +++ Completion/Unix/Type/_path_files 30 Jun 2008 19:55:41 -0000 @@ -598,7 +598,7 @@ compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \ -s "/${tmp3#*/}$ISUFFIX" \ -W "$prepath$realpath$testpath" \ - "$pfxsfx[@]" -M "r:|/=* r:|=*" \ + "$pfxsfx[@]" \ $listopts \ -a tmp1 else @@ -608,7 +608,7 @@ compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \ -s "$ISUFFIX" \ -W "$prepath$realpath$testpath" \ - "$pfxsfx[@]" -M "r:|/=* r:|=*" \ + "$pfxsfx[@]" \ $listopts \ -a tmp1 fi @@ -617,7 +617,7 @@ compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \ -s "$ISUFFIX" \ -W "$prepath$realpath$testpath" \ - "$pfxsfx[@]" -M "r:|/=* r:|=*" \ + "$pfxsfx[@]" \ $listopts \ -a tmp1 fi @@ -627,7 +627,7 @@ tmp4=( -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" -s "$ISUFFIX" -W "$prepath$realpath$testpath" - "$pfxsfx[@]" -M "r:|/=* r:|=*" ) + "$pfxsfx[@]" ) if [[ -z "$listsfx" ]]; then for i in "$tmp1[@]"; do tmpdisp=("${i%%/*}") @@ -647,7 +647,7 @@ compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp2" \ -s "$ISUFFIX" \ -W "$prepath$realpath$testpath" \ - "$pfxsfx[@]" -M "r:|/=* r:|=*" \ + "$pfxsfx[@]" \ $listopts \ -a tmp1 fi @@ -716,7 +716,7 @@ compadd -U -Qf "$mopts[@]" -p "$IPREFIX$linepath$tmp3/" \ -s "/$tmp4$i$ISUFFIX" \ -W "$prepath$realpath${mid%/*/}/" \ - "$pfxsfx[@]" -M "r:|/=* r:|=*" $listopts - "$tmp2" + "$pfxsfx[@]" $listopts - "$tmp2" done else if [[ "$osuf" = */* ]]; then @@ -747,7 +747,7 @@ compadd -U -Qf -p "$IPREFIX$linepath$tmp4" \ -s "$ISUFFIX" \ -W "$prepath$realpath$testpath" \ - "$pfxsfx[@]" "$mopts[@]" -M "r:|/=* r:|=*" $listopts -a tmp1 + "$pfxsfx[@]" "$mopts[@]" $listopts -a tmp1 fi fi fi -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/