From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6400 invoked from network); 10 May 2000 11:51:33 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 10 May 2000 11:51:33 -0000 Received: (qmail 4194 invoked by alias); 10 May 2000 11:51:21 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11298 Received: (qmail 4176 invoked from network); 10 May 2000 11:51:20 -0000 Date: Wed, 10 May 2000 13:51:18 +0200 (MET DST) Message-Id: <200005101151.NAA19364@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 10 May 2000 19:01:38 +0900 Subject: Re: PATCH: Re: _arguments problems Tanaka Akira wrote: > In article <200005100920.LAA13270@beta.informatik.hu-berlin.de>, > Sven Wischnowsky writes: > > > I don't get an error message, but I don't get the `B' inserted, > > either. The code that calculates which arguments are to be completed > > didn't take the `*pat' things into account. > > Z(4):akr@serein% Src/zsh -f > serein% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst > serein% _tst () { _arguments '-o:*a:a:(a)' ':A:(A)' ':B:(B)' } > serein% tst -o a > A B > > It shouln't complete `B'. Ouch. Yes. > > > It completes nothing. context parameter is not set? > > > > Yes. Which part of the docs made you think it would be set? $context > > is only mentioned for the `->state' actions and only then will it be > > set. > > I didn't think following paragraph is applied only when `->state' is > used. Maybe, this is my fault. > > The parameter `context' will be set to the automatically > created context names. These are either strings of the > form `option-opt-n' for the n'th argument of the option > -opt, or strings of the form `argument-n' for the n'th > argument (for rest arguments the n is the string `rest'). > For example, when completing the argument of the -o > option, the name is `option-o-1' and for the second normal > (non-option-) argument it is `argument-2'. Hmhm. $context is only mentioned for the `->state' actions above this, but we should probably make this clearer. Bye Sven Index: Doc/Zsh/compsys.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v retrieving revision 1.41 diff -u -r1.41 compsys.yo --- Doc/Zsh/compsys.yo 2000/05/10 09:22:49 1.41 +++ Doc/Zsh/compsys.yo 2000/05/10 11:51:09 @@ -3083,8 +3083,10 @@ given as one string, separated by colons. All colons in the original arguments are preceded with backslashes. -The parameter `tt(context)' will be set to the automatically created -context names. These are either strings of the form +The parameter `tt(context)' (only set in the calling function when +using an action of the form `tt(->)var(string)', not during the +evaluation of other var(action)s) will be set to the automatically +created context names. These are either strings of the form `tt(option)var(-opt)tt(-)var(n)' for the var(n)'th argument of the option var(-opt), or strings of the form `tt(argument-)var(n)' for the var(n)'th argument (for rest arguments the var(n) is the string Index: Src/Zle/computil.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v retrieving revision 1.17 diff -u -r1.17 computil.c --- Src/Zle/computil.c 2000/05/10 09:22:49 1.17 +++ Src/Zle/computil.c 2000/05/10 11:51:10 @@ -1198,14 +1198,12 @@ if (state.def->type == CAA_REST || state.def->type == CAA_RARGS || state.def->type == CAA_RREST) { - if (state.curopt) - state.oopt++; if (state.def->end && pattry(endpat, line)) { state.def = NULL; state.curopt = NULL; state.opt = state.arg = 1; state.argend = ca_laststate.argend = cur - 1; - continue; + goto cont; } } else if ((state.def = state.def->next)) { state.argbeg = cur; @@ -1378,6 +1376,8 @@ endpat = patcompile(state.def->end, 0, NULL); /* Copy the state into the global one. */ + + cont: if (cur + 1 == compcurrent) { memcpy(&ca_laststate, &state, sizeof(state)); -- Sven Wischnowsky wischnow@informatik.hu-berlin.de