All Manuals > LispWorks User Guide and Reference Manual > 13 Customization of LispWorks


13.4 Saved sessions

You can save a LispWorks session, which can be restarted at a later date. This allows you to resume work after restarting your computer.

Saving sessions is intended for users of the LispWorks IDE. The graphical tools described in LispWorks IDE User Guide provide the best way to use and configure session saving. However it is also possible to save a session programmatically, which is described in this section.

When you save a session, LispWorks performs the following three steps:

  1. Closing all windows and stopping multiprocessing.
  2. Saving an image. On Mac OS X this creates an application bundle.
  3. Restarting the LispWorks IDE and all of its windows.

If a saved session is run later, then it will redo the last step above, but see What is saved and what is not saved for restrictions.

Sessions are stored on disk as LispWorks images, by default within your personal application support folder (the exact directory varies between operating systems).

13.4.1 The default session

There is always a default session, which is used when you run the supplied LispWorks image.

When you run any other image directly, including a saved session or an image you created with save-image, it runs itself (not the default session).

Saved sessions are platform and version specific. In particular, a 32-bit LispWorks saved session cannot be the default session for 64-bit LispWorks, or vice-versa.

13.4.2 What is saved and what is not saved

All Lisp code and data that was loaded into the image or was created in it is saved. This includes all editor buffers, the Listener history and the value of *, ** and ***.

All threads are killed before saving, so any data that is accessible only through a mp:process, or by a dynamically bound variable, is not accessible.

All windows are closed, so any data that is accessible only within the windowing system is not accessible after saving a session.

The windows are automatically re-opened after saving the session and all Lisp data within the CAPI panes is retained.

External connections (including open files, sockets, database connections and COM interfaces) become invalid when the saved session is restarted. In the image from which the session was saved, the connections are not explicitly affected but if these connections are thread-specific, they will be affected because the thread is killed. In recreated Shell tools the command history is recovered but the side effects of those commands are not. Debugger and Stepper windows are not re-opened because they contain the state of threads that have been killed.

13.4.3 Saving a session programmatically

You can save a session by calling save-current-session Save Session actions

The first thing that save-current-session does is to execute the action-list "Save Session Before".

After redisplaying all the interfaces, the action-list "Save Session After" is executed. That happens both in the saving invocation and the restarting saved image. Non-IDE interfaces

If there are non-IDE interfaces on the screen when save-current-session is invoked, there interfaces are destroyed in the first step, and displayed again in the third step. Note that the display will occur in a different thread than the one running the interface before the saving (which was killed in the first step).

If the interface (or any of its children) contains information that is normally destroyed (in some sense) in the destroy-callback, this information can be preserved over a call to save-current-session by defining methods on the generic functions capi:interface-preserving-state-p or capi:interface-preserve-state.

13.4.4 Saving a session using the IDE

You can save a session or set up periodic automatic session saving using the configuration tools in the LispWorks IDE. See "Session Saving" in the LispWorks IDE User Guide for details.

LispWorks User Guide and Reference Manual - 13 Feb 2015