I find it really useful when developing packages to add this keyboard shortcut to my SystemFiles/FrontEnd/TextResources/Windows/KeyEventTranslations.tr
file.
(* Evaluate Initialization Cells: Real useful for reloading library changes. *)
Item[KeyEvent["i", Modifiers -> {Control, Command}],
FrontEndExecute[
FrontEndToken[
SelectedNotebook[],
"EvaluateInitialization"]]],
Next for every Packagename.m
I make a PackagenameTest.nb
notebook for testing and the first 2 cells of the test notebook are set as initialization cells. In the first cell I put
Needs["PackageManipulations`"]
to load the very useful PackageManipulations library which was written by Leonid. The second cell contains
PackageRemove["Packagename`Private`"]
PackageRemove["Packagename`"]
PackageReload["Packagename`"]
which all do the actual package reloading. Note the first two lines are there only to Remove
all symbols as I like to keep the contexts as clean as possible.
Then the workflow for writing and testing a package becomes something like this.
- Save changes to
Packagename.m
.
- Go to
PackagenameTest.nb
and do CTRL + ALT + i
.
This causes the initialization cells to reload the package, which makes testing real simple.