lshifr / CodeFormatter

A pretty-printer for Mathematica language, working on the box level
Other
33 stars 7 forks source link

Uncaught exception when using colorsetters as part of the code #4

Open scdevries opened 12 years ago

scdevries commented 12 years ago

Mathematica allows the use of colorsetters as part of the code (so that the programmer can conveniently choose a new color right in the middle of the source by just clicking). A line of code may read like this:

edgeColor = !(* TagBox[ ColorSetterBox[RGBColor[1., 0., 0.], "Swatch"], Setting]);

One enters this by DynamicSetting[ColorSetter[]] and executing-in-place (ctrl-shift-enter). Prettifying a line like this yields:

During evaluation of In[164]:= Throw::nocatch: Uncaught Throw[{$Failed,ColorSetterBox[RGBColor[1.,0.,0.],Swatch]},CodeFormatterPrivatepreformat] returned to top level. >>

Out[164]= Hold[ Throw[{$Failed, ColorSetterBox[RGBColor[1., 0., 0.], "Swatch"]}, CodeFormatterPrivatepreformat]]

[I know this is perverse coding]