On Thu, 23 Jul 2009, Wolfgang Schuster wrote:
Am 23.07.2009 um 17:05 schrieb Aditya Mahajan:
I think an easier thing to do will be to follow latex's style of
\newcommand and \renewcommand. That is, all \definecommands should check if
the macro is previously defined or not. If it is defined, issue a warning
or an error.
There is \define and \redefine.
I know. What I am asking is that the core macros like \definedescription,
\defineitemgroups, \definehead, which have the general form
\def\defineSOMETHING%
{\dodoubleargument\dodefineSOMETHING}
\def\dodefineSOMETHING[#1][#2]%
{\setvalue{#1}{\dododefineSOMETHING[#2]}
should do some check before the \setvalue. Maybe a universal solution will
be to change \setvalue so that it uses \define (or a check like define)
internally.
And maybe have some hook to disable the warning/error for those who know
what they are doing.
In this case you can use \def, \edef ...
I meant with commands like \defineSOMETHING above. For example, I once did
\definecolor[page][s=0.9] instead of what I normally do:
\definecolor[pagecolor][s=0.9]. Took a while to figure out what was going
wrong. Some of Xan's error were due to similar things,
\defineSOMETHING[note], \defineSOMETHING[symbol], etc. If all these
commands issued a warning that you are redefining existing macro,
debugging will be much easier. And if you know what you are doing, we
could have
\redefinecolor[page][s=0.9]
that does not issue a warning. Or the easier to implemnet:
\setupcolors[check=error|warn|ignore]
for all \setupSOMETHING commands where the equivalent \defineSOMETHING
defines a control sequence.
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________