Brooks Moses wrote:
Also, since \startmyenv does all this in a group, the local settings on the inner environment don't contaminate the ones in the outer environment.
If you can get away with destroying the local variables at the end of the expansion of \startmyenv, they you can remove the \copyparameters altogether by using grouping around the \setup command: \def\startmyenv[#1]% {\begingroup \setupmyenv[#1]% ... normal processing here ... \endgroup} Also, if you wanted to change 'only some' options runtime, then you could put those in a temporary namespace, and check their existance specifically instead of copying everything, but that's not what you want, I take it.
Any suggestions for a better solution? I couldn't find any environments in the ConTeXt core that do this sort of nesting....
I think you have found the right solution for the general problem. That is to say: every other thing I can come up with is a special case for optimization, instead of a significantly better approach. ;-) Cheers, Taco