Thanks. I think this will be a big improvement. A gentle nudge on having trap DEBUG (if not other traps as well) inherited in subshells. ;-) Thanks again. On Thu, Sep 11, 2008 at 8:00 AM, Peter Stephenson wrote: > On Wed, 10 Sep 2008 14:51:04 -0400 > "Rocky Bernstein" wrote: > > Also (mentioned previously), I think the multiple function definition > with a > > single body syntax should be removed when sh or bash emulation is in > effect. > > Those POSIX shell variants neither support this form and having it around > > allows it to get confused causing a more obscure error message when one > > writes "typeset -a foo=(list)" which is valid in those other POSIX shell > > variants. > > (Moved to zsh-workers.) > > That's probably useful; it's been spotted before that multiple function > definitions of this form can be pretty confusing to zsh users, too. > > Note, however, that the case you showed already gives a different error, > since the parentheses aren't empty. In bash/ksh emulation you should get > the reasonable "typeset: foo: can't assign initial value for array". > > Index: Doc/Zsh/options.yo > =================================================================== > RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v > retrieving revision 1.63 > diff -u -r1.63 options.yo > --- Doc/Zsh/options.yo 7 Aug 2008 16:27:15 -0000 1.63 > +++ Doc/Zsh/options.yo 11 Sep 2008 11:43:08 -0000 > @@ -1133,6 +1133,14 @@ > > will restore normally handling of tt(SIGINT) after the function exits. > ) > +pindex(MULTI_FUNC_DEF) > +item(tt(MULTI_FUNC_DEF) )( > +Allow definitions of multiple functions at once in the form `tt(fn1 > +fn2)var(...)tt(LPAR()RPAR())'; if the option is not set, this causes > +a parse error. Definition of multiple functions with the tt(function) > +keyword is always allowed. Multiple function definitions are not often > +used and can cause obscure errors. > +) > pindex(MULTIOS) > item(tt(MULTIOS) )( > Perform implicit bf(tee)s or bf(cat)s when multiple > Index: Src/options.c > =================================================================== > RCS file: /cvsroot/zsh/zsh/Src/options.c,v > retrieving revision 1.45 > diff -u -r1.45 options.c > --- Src/options.c 7 Aug 2008 16:27:15 -0000 1.45 > +++ Src/options.c 11 Sep 2008 11:43:08 -0000 > @@ -181,6 +181,7 @@ > 0 > #endif > }, MULTIBYTE}, > +{{NULL, "multifuncdef", OPT_EMULATE|OPT_ZSH}, > MULTIFUNCDEF}, > {{NULL, "multios", OPT_EMULATE|OPT_ZSH}, MULTIOS}, > {{NULL, "nomatch", OPT_EMULATE|OPT_NONBOURNE},NOMATCH}, > {{NULL, "notify", OPT_ZSH}, NOTIFY}, > Index: Src/parse.c > =================================================================== > RCS file: /cvsroot/zsh/zsh/Src/parse.c,v > retrieving revision 1.73 > diff -u -r1.73 parse.c > --- Src/parse.c 1 Sep 2008 20:18:48 -0000 1.73 > +++ Src/parse.c 11 Sep 2008 11:43:08 -0000 > @@ -1663,6 +1663,9 @@ > zlong oldlineno = lineno; > int onp, so, oecssub = ecssub; > > + if (!isset(MULTIFUNCDEF) && argc > 1) > + YYERROR(oecused); > + > *complex = c; > lineno = 0; > incmdpos = 1; > Index: Src/zsh.h > =================================================================== > RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v > retrieving revision 1.145 > diff -u -r1.145 zsh.h > --- Src/zsh.h 3 Sep 2008 09:08:22 -0000 1.145 > +++ Src/zsh.h 11 Sep 2008 11:43:08 -0000 > @@ -1882,6 +1882,7 @@ > MENUCOMPLETE, > MONITOR, > MULTIBYTE, > + MULTIFUNCDEF, > MULTIOS, > NOMATCH, > NOTIFY, > > > -- > Peter Stephenson Software Engineer > CSR PLC, Churchill House, Cambridge Business Park, Cowley Road > Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 >