# FullForm with context for each symbol?

FullForm strips the context for any symbol that can be found on the Append[$ContextPath,$Context]: FullForm[SystemList] is displayed List, but I would like to get SystemList for debugging and learning purposes.

I tried $ContextPath = {} but then the whole front-end stops working [1]. Is there another way besides Hold[...] /. x_Symbol :> (Context@x <> SymbolName@Unevaluated@x)  Is there any case where this would not work? [1] I find it strange that the internal code of the FrontEnd relies on the "usability features" $Context and $ContextPath. Why doesn't it use the full symbol names for any code it uses (or produces)? IMO $ContextPath = {} should hurt you (having to type the full name of any symbols not in $Context), but not the system. If it really needs System to operate properly, it should not allow setting $ContextPath = {} just like it is not allowed to set $Context to something invalid. [2] Note that Context has HoldFirst while SymbolName doesn't, hence the Unevaluated. ## 2 Answers 1. To not mess with $ContextPath you can Block it just for that evaluation. e.g. Block[{$ContextPath = {}}, ...]. But we don't want to do that for the evaluation, input for FullForm should be evaluated freely and only the result should be returned with full symbols' names. To achieve that you should know: 2. $ContextPath and $Context affect the typesetting. MakeBoxes will strip those contexts from an evaluated FullForm. So, to deal with 2 we have to perform MakeBoxes on our rules (local contexts values) and order that to not be touched by MakeBoxes anymore (RawBoxes): Block[{$ContextPath = {}, $Context = "other"} , RawBoxes @ ToBoxes @ FullForm @ {x, 1} ]  SystemList[Globalx,1]  It is very convenient when we want to "toggle a visibility" of specific contexts: Block[{$ContextPath = {"System"}, ...

 List[Globalx,1]

• Very clever! :^) – Mr.Wizard Jul 7 '16 at 6:26

Based on Kuba's idea, this may also work:

RawBoxes@MakeBoxes[FullForm[p + q]] /.
x_String :> Context[Evaluate@Symbol@x] <> Last@StringSplit[x, ""] /; NameQ[x]
`