From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10161 invoked from network); 11 Feb 2000 10:48:23 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 11 Feb 2000 10:48:23 -0000 Received: (qmail 23817 invoked by alias); 11 Feb 2000 10:48:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9676 Received: (qmail 23809 invoked from network); 11 Feb 2000 10:48:17 -0000 Date: Fri, 11 Feb 2000 11:48:14 +0100 (MET) Message-Id: <200002111048.LAA29492@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Alexandre Duret-Lutz's message of 11 Feb 2000 11:14:10 +0100 Subject: Re: PATCH: _diff Alexandre Duret-Lutz wrote: > X-Seq: 9675 > > >>> "Sven" == Sven Wischnowsky writes: > > Sven> Oliver Kiddle wrote: > > >> I object to using > >> non-local variables like _diff_is_gnu and calling 'diff' instead of > >> pulling out the first word on the command-line. > > Sven> Well, if we use something like _diff_is_gnu[$words[1]], using a > Sven> non-local variable should be fine, right? > > I don't think so, because _diff_options may be called from places where > $words[1] is not the command name, e.g. called from _prcs (maybe _cvs_diff > could call it too). Err, right, I forgot... > Hum, looking closer to _prcs, I see there is a problem, if I do > > % prcs diff -P zsh -- -u > > the values of $words when entering the _diff_options functions are > > diff -P zsh -- -u > > (this begin with diff since $words was shifted in _prcs) > and the -P option is removed from the diff options list, which is wrong. > I'd like this array te be restricted to > > -- -u > > unfortunately, I don't see how to do that with _arguments. > The _arguments line calling _diff_options reads > > '--[introduce diff options]:*:diff options: _diff_options' > > I can't use the `*::message:action' syntax here. So I guess > I have to write an intermediate function that shift the $words > array $CURRENT times before calling _diff_options. Or I am missing > some syntaxic sugar in _arguments? Of course, `--:*::...' should work (reporting anything after the `--'), there was just a little thinko in ca_parse_line(). Bye Sven diff -ru ../z.old/Src/Zle/computil.c Src/Zle/computil.c --- ../z.old/Src/Zle/computil.c Fri Feb 11 09:23:09 2000 +++ Src/Zle/computil.c Fri Feb 11 11:46:04 2000 @@ -1235,12 +1235,12 @@ else { LinkList l = state.oargs[state.curopt->num]; + if (cur < compcurrent) + memcpy(&ca_laststate, &state, sizeof(state)); PERMALLOC { for (; line; line = compwords[cur++]) addlinknode(l, ztrdup(line)); } LASTALLOC; - if (cur < compcurrent) - memcpy(&ca_laststate, &state, sizeof(state)); ca_laststate.ddef = NULL; ca_laststate.doff = 0; break; -- Sven Wischnowsky wischnow@informatik.hu-berlin.de