The best way to work with a Lisp is to leave it running all the time and hack on it bit by bit, building up your program bit by bit, doing mini-tests and off-the-cuff code as you go along and shaping it..
Except if you are like me, you might be working on a laptop with a limited battery life and have a strict time limit to your lisp hacking. It's bothered me that when working with SLIME the only way to save a core was to start a lisp in a terminal, load up your systems and your files, then dump and use that with C-u M-x slime, which lets you enter a command line to start your lisp.
It annoys me because if you are like me, your code doesn't necessarily capture the actual state of your core: it also contains half a dozen test variables and functions that you entered in the repl and are useful to have hang around. So I tried to find a way to dump and restore core from within slime. I came up with the following function
(defun save-slime-and-die (core-file-name)
;; close all
(mapcar #'(lambda (x) (swank::close-connection x)) swank::*connections*)
#+sb-thread
(dolist (thread (remove (swank::current-thread) (swank::all-threads)))
(swank::kill-thread thread))
(sleep 1)
(save-lisp-and-die core-file-name))
It's obviously for sbcl, and the gotcha is that it has to be executed in the *inferior-lisp* buffer, but it works..C-u M-x sbcl --core test.core brings back core dumped with (save-slime-and-die #P"test.core")