Here's an attempt at something like this:
Dynamic@Row@{$sym, " = ", Symbol@$sym}
Unprotect@FE`CacheTemplateAndUsage;
FE`CacheTemplateAndUsage[sym_String] /; Context@arg == "Global`" :=
(
$sym = sym;
MathLink`CallFrontEnd@
FrontEnd`CacheTemplateAndUsagePacket[FrontEnd`InputNotebook[], sym,
Null]
)
The symbol name and its value is displayed in the top cell after hovering over a symbol for a few seconds. Some notes:
- This is using undocumented functionality, so use it at your own risk (it might also break at any moment)
- The idea is to intercept the call the front-end makes to get the usage information for a symbol. After this is successful once, it will never be done again, so we need to make sure to always return an empty usage
- Currently it is limited to symbols in the global context, since for system symbols you probably want to see the info dropdown
- The front-end needs to think that a value is assigned to the symbol (or something like that, not quite sure on the specifics). Usually any symbol with a definition should fall into this category, but in some circumstances the front-end is not aware of existing symbol definitions.
a = 4; Mouseover[HoldForm[a], a]
? $\endgroup$Mouseover
. Currently I'm also looking intoSelectionMove
. $\endgroup$