I have some definitions in my init.m
. E.g. my init.m
contains this:
hex[n_]:=BaseForm[n,16];
I know that Mathematica puts this in the Global`
context, and in a default configuration, each notebook's $Context
is Global`
and its $ContextPath
also contains Global`
. So my definitions are automatically available in any notebook I create.
However, I prefer the CellContext->Notebook
option so each of my notebooks automatically gets its own private context. The problem is that this option (obviously) changes $Context
to something other than Global`
, and it also removes Global`
from $ContextPath
. So my init.m
definitions are not automatically available in any notebook I create.
Now, I could type Global`hex
when I want to use my hex
function, or I could do AppendTo[$ContextPath, "Global`"]
in each notebook. But I would rather have Global`
added to each notebook's $ContextPath
automatically.
Is there a way to get Global`
into each notebook's $ContextPath
automatically? Or is there some other way I can make my personal definitions available to each notebook automatically while using the CellContext->Notebook
option?