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

Re: Info MCL Digest Digest V2 #14

Andrew Mickish (amickish@cs.cmu.edu) wrote:

>10)  While developing my application, I frequently need to quit my lisp
>     listener and load my files from scratch.  However, this also kills all
>     the FRED windows that I have brought up during my session.  Is there
>     any way to spawn a new lisp process without dumping my FRED windows?

I use the following code in my Init.Lisp file:

;; Remember open FRED windows when we quit.

(defconstant *window-logfile-name* "CCL:WorkFiles")

(flet ((remember-fred-files ()
         (with-open-file (window-log
                          :direction :output :if-exists :supersede)
            #'(lambda (w)
                (let ((fname (window-filename w)))
                  (when fname (print fname window-log))))
            :class 'fred-window))))
  ;I can't do (advise quit (remember-fred-files)), because quit is already
  ;bound to the Quit item in the File menu. To make advise work on quit, I'd
  ;have to bind the advised quit to the menu-item-action-function.
  ;This is simpler and faster, and who cares about portability?
  (pushnew #'remember-fred-files *lisp-cleanup-functions*))

;; Reopen the files that were open last time we quit.

(with-open-file (window-log
                 :direction :input :if-does-not-exist nil)
  (when window-log (let ((fname))
                     (loop (setf fname (read window-log nil))
                           (if fname
                             (when (probe-file fname)
                               (ed fname))