4
$\begingroup$

AFAICT, when given a built-in symbol as argument, Messages returns an empty list, at least initially.

For example:

Quit (* reset *)
Messages[ListPlot]

{}

After running ??ListPlot, however, I get

Messages[ListPlot]
{HoldPattern[ListPlot::usage] :> ListPlot[{y1y2, …}] plots points {1, y1}, 
{2, y2}, …. 
ListPlot[{{x1y1}, {x2y2}, …}] plots a list of points with specified x and y
coordinates. 
ListPlot[{data1data2, …}] plots data from all the datai.
ListPlot[{… , w[datai, …], …}] plots datai with features defined by the
symbolic wrapper w.}

If I then elicit some error message, e.g. by running ListPlot[{1, 2, 3}, PlotRange -> InvalidPlotRangeSetting], I get

Messages[ListPlot]
{HoldPattern[ListPlot::prng] :> Value of option PlotRange -> `1` is not All,
Full, Automatic, a positive machine number, or an appropriate list of range
specifications.,
HoldPattern[ListPlot::usage] :> ListPlot[{y1y2, …}] plots points {1, y1}, 
{2, y2}, …. 
ListPlot[{{x1y1}, {x2y2}, …}] plots a list of points with specified x and y
coordinates. 
ListPlot[{data1data2, …}] plots data from all the datai.
ListPlot[{… , w[datai, …], …}] plots datai with features defined by the
symbolic wrapper w.}

IOW, it's like pulling teeth... Totally impractical.

Is there a practical way to really get all the messages associated with a built-in symbol?

$\endgroup$
  • $\begingroup$ Note that some messages actually belong to General, e.g. General::prng. $\endgroup$ – J. M. is away Apr 6 '17 at 16:53
2
$\begingroup$

You can read them directly from the Messages.m file.

path = FileNameJoin[{$InstallationDirectory, "SystemFiles", "Kernel",
    "TextResources", "English", "Messages.m"}];

allMessages = Import[path, "HeldExpressions"];

symbolToLookup = ListPlot;

Select[allMessages, MemberQ[#, symbolToLookup, Infinity, Heads -> True] &]

To get usage messages load "Usage.m" instead of "Messages.m".

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.