Skip to main content
2 of 2
Mention color coding and OwnValues.
Taliesin Beynon
  • 10.7k
  • 46
  • 52

In version 10.1, I've built something like Spelunk into GeneralUtilities` .

To use it, run

Needs["GeneralUtilities`"]
PrintDefinitions[symbol];

This will pop up a window that shows all definitions of symbol. Here is a short summary of features:

  • The window shows code cells containing all DownValues, OwnValues, UpValues, SubValues, and Attributes of a symbol.
  • Most pathological kinds of StandardForm are avoided, so that Image, Graphics, Row, Column, SparseArray, etc. will show up as code, not UI elements. This is achieved via the PlainForm and CodeForm wrappers, which can also be found in GeneralUtilities` .
  • Hyperlinks are be injected as appropriate. Click on a hyperlinked symbol to print its definitions in a new window.
  • The CellContext of each code cell is set to reduce the amount of clutter from fully qualified private symbols. For symbols outside this context, the name is shown, the fully qualified name is tooltipped, and color coding is used: symbols in conventional private contexts like `Private` are brown/orange; system symbols are black; other symbols are dark gray if on the context path, otherwise light gray.

Here's a simple example of PrintDefinitions running on itself:

enter image description here

Taliesin Beynon
  • 10.7k
  • 46
  • 52