HowTo: Fix usage message errors
- To: mathgroup at smc.vnet.net
- Subject: [mg95413] HowTo: Fix usage message errors
- From: "Q.E.D." <aoe at netzero.net>
- Date: Sun, 18 Jan 2009 05:29:24 -0500 (EST)
Five usage messages show error icons in version 7 when evaluated. Two of them also display pink error boxes and also manifest in version 6. Demonstate the errors by evaluating the following: Length[Print[ToExpression[# <> "::usage"]]; & /@ {"FontName", "FromServiceResponse", "InvokeServiceOperation", "$PrintServiceRequest", "$PrintServiceResponse"}] Oddly, evaluating ?Print afterwards causes the three without pink error boxes to have their error icons disappear. When the following is evaluated, notice how the three without pink error boxes have error icons appear and then disappear: Length[Information[#, LongForm -> False] & /@ {"FontName", "FromServiceResponse", "InvokeServiceOperation", "$PrintServiceRequest", "$PrintServiceResponse"}] Evaluate the following to see what the usage strings look like when fixed: StringReplace[FontName::usage, {"\"\"Times-Roman\"\""->"\"\\\"Times-Roman\\\"\""}] StringReplace[FromServiceResponse::usage, {"\" Italic \""->"\"Italic\""}] StringReplace[InvokeServiceOperation::usage, {"StyleBox[RowBox[{\" \" \", \" url \", \" \" \"}], \" TI \"]" -> "StyleBox[RowBox[{\"\\\"\", \"url\", \"\\\"\"}], \"TI\", ShowStringCharacters->True]"(*for version 7*), "StyleBox[RowBox[{\"\"\", \"url\", \"\"\"}], \"TI\"]" -> "StyleBox[RowBox[{\"\\\"\", \"url\", \"\\\"\"}], \"TI\", ShowStringCharacters->True]"(*for version 6*)}] StringReplace[$PrintServiceRequest::usage, {"\" Italic \""->"\"Italic\""}] StringReplace[$PrintServiceResponse::usage, {"\" Italic \""->"\"Italic\""}] To fix the usage strings in the current session, evaluate: FontName::usage = StringReplace[FontName::usage, {"\"\"Times-Roman\"\""->"\"\\\"Times-Roman\\\"\""}]; FromServiceResponse::usage = StringReplace[FromServiceResponse::usage, {"\" Italic \""->"\"Italic\""}]; InvokeServiceOperation::usage = StringReplace[InvokeServiceOperation::usage, {"StyleBox[RowBox[{\" \" \", \" url \", \" \" \"}], \" TI \"]" -> "StyleBox[RowBox[{\"\\\"\", \"url\", \"\\\"\"}], \"TI\", ShowStringCharacters->True]"(*for version 7*), "StyleBox[RowBox[{\"\"\", \"url\", \"\"\"}], \"TI\"]" -> "StyleBox[RowBox[{\"\\\"\", \"url\", \"\\\"\"}], \"TI\", ShowStringCharacters->True]"(*for version 6*)}]; $PrintServiceRequest::usage = StringReplace[$PrintServiceRequest::usage, {"\" Italic \""->"\"Italic\""}]; $PrintServiceResponse::usage = StringReplace[$PrintServiceResponse::usage, {"\" Italic \""->"\"Italic\""}]; Now evaluate again the following to check that there are no longer any error icons: Length[Information[#, LongForm -> False] & /@ {"FontName", "FromServiceResponse", "InvokeServiceOperation", "$PrintServiceRequest", "$PrintServiceResponse"}] Note that that the three which do have the extra spaces around the Italic value do not fail in version 6 because those usage messages in version 6 do not have extra spaces around the Italic value. Q.E.D.