# how to load everything when opening a saved notebook

generally, when I carry over work in a notebook from the previous day, I have to physically start from the top and re-evaluate every statement before I can begin from where i left off. Is there any setting I can enable so that the notebook will be in state when it becomes active? Thanks, Sid.

-
No. But you can do: DumpSave["today.mx", "Global*"] and then load it the next day by Get@"today.mx" –  Rolf Mertig Oct 3 '13 at 17:04
Well, thanks. I have not tried this yet. Actually, this happens also if I leave Mathematica (not quit i.e) for some time and work on other things, and then get back to it. Have others also observed this? I just checked that the "Dynamic updating enabled" menu item was checked, so probably there must be some other setting that can achieve this, in addition to Rolf's answer. –  Sid Oct 4 '13 at 17:20
The definitions and variables are not associated with the notebook. The notebook merely holds some code that can be used to create these definitions. Rolf's answer is the partial workaround. If you had packages loaded, you'll still need to re-load them. –  Szabolcs Oct 4 '13 at 19:43
@Sid could you upload a notebook somewhere so we can try ourselves? –  Rolf Mertig Oct 4 '13 at 19:53

(Based on Rolf's and Szabolcs's comments)

The definitions and variables created during evaluation are not associated with a particular notebook: they are stored in the memory. The notebook merely holds some code that can be used to create these definitions.

You can save all the definition defined in the "Global" context by DumpSave and then load them the next day by Get:

DumpSave["today.mx", "Global*"]

Get@"today.mx"


If you want the Get code to be evaluated every time you start the kernel, put the above line into the file:

FileNameJoin[{\$UserBaseDirectory, "Kernel", "init.m"}]


This, however, is only a partial workaround: it does not save any definition from other user-modified namespaces than "Global" - though it is easy to extend it to other modified contexts if their names are known. Also, if you had packages loaded, it's easier to simply re-load them at the start of your session than to DumpSave their states at the end of the day.

-