[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tiny hack to save state in mcl

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)))
      (print `(set-choose-file-default-directory ,(namestring (choose-file-default-directory)))

(pushnew #'save-state *LISP-CLEANUP-FUNCTIONS*)
(when (probe-file *saved-state-file-name*) (load *saved-state-file-name*))