From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14060 invoked from network); 9 Oct 2000 12:49:07 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 9 Oct 2000 12:49:07 -0000 Received: (qmail 21459 invoked by alias); 9 Oct 2000 12:48:21 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12930 Received: (qmail 21452 invoked from network); 9 Oct 2000 12:48:20 -0000 Date: Mon, 9 Oct 2000 14:48:18 +0200 (MET DST) Message-Id: <200010091248.OAA20614@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Fri, 6 Oct 2000 16:11:01 +0000 Subject: PATCH: Re: Option completion after "nono" Bart Schaefer wrote: > On Oct 6, 2:53pm, Sven Wischnowsky wrote: > } > } We use nonomatch not because of globbing, but because of ~... and > } =... expansion. > > Speaking of using nonomatch, have you tried to complete it? > > zagzig% setopt nonom > nonomagicequalsubst nonomarkdirs nonomultios > nonomailwarn nonomenucomplete > nonomailwarning nonomonitor > > Hmm, where is it? > > ... > > There has to be some kind of matcher-magic to insert into _options (and > into the example in the "Matching Control" doc) that means to accept > matches both with _and without_ the leading "no" deleted, but I can't > work out what it is. Hm, I think it should do the right thing without using match-spec hacks. The patch below does that by preferring exact character matches over using match specs. I know I once had a reason for doing it differently, but I can't remember which. The completion matching tests work and the only ones that might be in danger are ones with partial word matching (as far as I can see). And the recusive code for that has been improved several times since I made it prefer match specs over exact character matches. So I've left a comment in there and we'll see if it breaks anything. If it doesn't, fine, that would make matching quite a bit faster... Bye Sven Index: Src/Zle/compmatch.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v retrieving revision 1.23 diff -u -r1.23 compmatch.c --- Src/Zle/compmatch.c 2000/07/19 14:04:57 1.23 +++ Src/Zle/compmatch.c 2000/10/09 12:47:39 @@ -485,10 +485,19 @@ * recursive calls. At least, it /seems/ to work. * * Let's try. + * + * Update: this once tested `test && ...' to check for exact + * character matches only in recursive calls. But then one + * can't complete `nom' to `nomatch' with a match spec + * of `B:[nN][oO]=' because that will eat the `no'. I'm almost + * certain that this will break something, but I don't know what + * or if it really is a problem (or has been fixed by other + * changes in the code handling partial word matching). And the + * completion matching tests work. */ bslash = 0; - if (test && !sfx && lw && + if (!sfx && lw && (l[ind] == w[ind] || (bslash = (lw > 1 && w[ind] == '\\' && (ind ? (w[0] == l[0]) : (w[1] == l[0])))))) { -- Sven Wischnowsky wischnow@informatik.hu-berlin.de