9.2 The Change Log

Cuis-Smalltalk records any action occurring in the environment: the code you edit in the System Browser, the code you execute in a Workspace. Therefore, in the event of a Cuis-Smalltalk crash you can restore unsaved changes when you launch the same Cuis-Smalltalk image again. Let’s explore this feature with a simple example.

On a fresh Cuis-Smalltalk installation, first set the appropriate preference by executing in a Workspace: Preferences at: #checkLostChangesOnStartUp put: true. Now create a new class category named TheCuisBook and within TheBook class:

Open a Workspace, then key in the following code:

| myBook |
myBook := TheBook new

Cuis-Smalltalk does not save code you key in the Workspace, but code you execute. Let’s execute this code: Ctrl-a then Ctrl-p, the Workspace prints the result: a TheBook, an instance of a TheBook class.

Now kill Cuis-Smalltalk abruptly. On GNU/Linux, you can use the xkill command to terminate Cuis-Smalltalk by clicking at its window.

Now start Cuis-Smalltalk again, and it immediately informs you there are unsaved changes:

ch10-RecoverLostChanges1

Figure 9.1: Cuis-Smalltalk informs about lost changes

From there you have three options: