[Next] [Previous] [Up] [Top] [Contents] [Index]
Recovering or aborting
Aborting
When the problem is obvious and is not inside a deeply nested time-consuming computation, it is often easiest to cancel out of the execution and start over.
- Cancel out of the execution.
Press Command-period or choose the Abort command from the Lisp menu.
- Edit the form.
Press Option-G to bring back the last expression as you originally typed it. Edit the expression to replace the call to close-window with a call to window-close. (In the more usual case, the error would be in a compiled function or other definition. You would use option-period to get to the source code, and then edit and recompile the definition.)
- Retry the execution.
Press Return to try again. Assuming no other errors have been introduced, execution should complete successfully and the window should close.
When an error occurs in the middle of a long computation--for example, in the middle of a 3,000 file compilation--you will probably want to find a way to recover and continue the computation rather than aborting and starting over.
Options for recovery may include skipping some part of the computation (for example, not compiling one of the 3,000 files), or they may include changing your Lisp environment in some way so that the function which hit the error can be reinvoked successfully.
The simple error above can be handled by defining the function close-window and retrying the computation:
- Recreate the error condition by creating a window and trying to close it by calling
close-window.
- Define
close-window.
1> (defun close-window (w) (window-close w))
CLOSE-WINDOW
- Continue from the error.
Press command-/ or choose Continue from the Lisp menu. The execution should complete successfully and the window should close.
The Restarts window automatically gathers all possible ways of recovering from an error. It always offers you the option of canceling and sometimes offers other options for continuing. If there are multiple nested break loops, Restarts gives you the option of returning to any of them.
In some cases, such as the one shown above, Restarts offers more specific suggestions. Here the option "Apply specified function to (#<WINDOW "Untitled" #x4D4D99>)..." lets you call another function, rather than window-close.
Figure 4-4 The restarts window

- Recreate the same error as above.
- Open the Restarts window.
Select the Restarts... command from the Lisp menu. Notice that when you attempt to call a function which is not defined, one of your options is to complete the computation by calling a different function on the same arguments.
- Find the correct function to call.
Select the Apropos command from the Tools menu. Search for all functions that include both "close" and "window" in their names. There are only two such functions, and only one likely candidate for this operation.
- Restart the computation.
Return to the Restarts window and select "Apply specified function...". Enter the correct function name in the ensuing dialog, and press Return. MCL completes the computation and closes the window.
Since the Restarts window is generated by a fixed algorithm, it often suggests the same restart multiple times. In such cases, it doesn't matter which copy you choose. (However, if there are multiple levels of break loop, make sure you're not choosing to return to a point in the wrong one!)
Gettmg Started with MCL - 19 OCT 1996
[Next] [Previous] [Up] [Top] [Contents] [Index]
Generated with Harlequin WebMaker