[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tiny hack to save state in mcl
- To: info-mcl@ministry.cambridge.apple.com
- Subject: tiny hack to save state in mcl
- From: neves@aristotle.ils.nwu.edu (Neves )
- Date: 8 Dec 1993 20:39:32 GMT
- Newsgroups: comp.lang.lisp.mcl
- Organization: The Institute for the Learning Sciences
Here is a useful hack that I put in my init.lisp file so that lisp
will reedit files that were opened when I last exited lisp. It also
saves away the current default directory.
(defvar *saved-state-file-name* "ccl:saved-state")
(defun save-state nil
(with-open-file (stream *saved-state-file-name* :direction :output :if-exists :supersede)
(dolist (win (reverse (windows)))
(when (window-filename win)
(print `(ed ,(namestring (window-filename win)))
stream)))
(print `(set-choose-file-default-directory ,(namestring (choose-file-default-directory)))
stream)))
(pushnew #'save-state *LISP-CLEANUP-FUNCTIONS*)
(when (probe-file *saved-state-file-name*) (load *saved-state-file-name*))