#'END-EVENT-LOOP & cleanup
Sun Jun 7 09:47:13 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* #'END-EVENT-LOOP & cleanup
hunk ./src/package.lisp 9
+ #:end-event-loop
hunk ./src/repl.lisp 28
-(defun end-event-loop ()
- #+slime
- (setf (fdefinition 'swank::eval-region)
- #'(lambda (string)
- (with-input-from-string (stream string)
- (let (- values)
- (loop
- (let ((form (read stream nil stream)))
- (when (eq form stream)
- (fresh-line)
- (finish-output)
- (return (values values -)))
- (setq - form)
- (setq values (multiple-value-list (eval form)))
- (finish-output)))))))
- (cxx:quit (qt:app)))
- [_$_]
-(defun start-event-loop-in-background ()
- "Starts the QApplication event loop in a new thread and
+(let ((eval-region-orig))
+ (defun end-event-loop ()
+ #+slime
+ (progn
+ (assert eval-region-orig)
+ (setf (fdefinition 'swank::eval-region)
+ eval-region-orig)
+ (setf eval-region-orig nil))
+ (cxx:quit (qt:app)))
+ (defun start-event-loop-in-background ()
+ "Starts the QApplication event loop in a new thread and
hunk ./src/repl.lisp 40
- ;; Like eval-region of Slimes swank.lisp
- #+slime
- (setf (fdefinition 'swank::eval-region)
- #'(lambda (string)
- (with-input-from-string (stream string)
- (let (- values)
- (loop
- (let ((form (read stream nil stream)))
- (when (eq form stream)
- (fresh-line)
- (finish-output)
- (return (values values -)))
- (setq - form)
- (setq values (multiple-value-list (qt-eval form)))
- (finish-output)))))))
- (let ((standard-input *standard-input*)
- (standard-output *standard-output*)
- (debug-io *debug-io*)
- (trace-output *trace-output*)
- (error-output *error-output*)
- (query-io *query-io*)
- (terminal-io *terminal-io*)
- (ready-lock (bt:make-lock))
- (ready (bt:make-condition-variable)))
- (bt:make-thread #'(lambda ()
- #+slime
- (setf *standard-input* standard-input
- *standard-output* standard-output
- *debug-io* debug-io
- *trace-output* trace-output
- *error-output* error-output
- *query-io* query-io
- *terminal-io* terminal-io)
- (qt:with-app
- (qt:application.set-quit-on-last-window-closed nil)
- (setf *qt-eval* (make-instance 'qt-eval))
- (qt:do-delayed-initialize [_$_]
+ ;; Like eval-region of Slimes swank.lisp
+ #+slime
+ (progn
+ (assert (null eval-region-orig))
+ (setf eval-region-orig
+ #'swank::eval-region)
+ (setf (fdefinition 'swank::eval-region)
+ #'(lambda (string)
+ (with-input-from-string (stream string)
+ (let (- values)
+ (loop
+ (let ((form (read stream nil stream)))
+ (when (eq form stream)
+ (fresh-line)
+ (finish-output)
+ (return (values values -)))
+ (setq - form)
+ (setq values (multiple-value-list (qt-eval form)))
+ (finish-output))))))))
+ (let ((standard-input *standard-input*)
+ (standard-output *standard-output*)
+ (debug-io *debug-io*)
+ (trace-output *trace-output*)
+ (error-output *error-output*)
+ (query-io *query-io*)
+ (terminal-io *terminal-io*)
+ (ready-lock (bt:make-lock))
+ (ready (bt:make-condition-variable)))
+ (bt:make-thread #'(lambda ()
+ #+slime
+ (setf *standard-input* standard-input
+ *standard-output* standard-output
+ *debug-io* debug-io
+ *trace-output* trace-output
+ *error-output* error-output
+ *query-io* query-io
+ *terminal-io* terminal-io)
+ (qt:with-app
+ (qt:application.set-quit-on-last-window-closed nil)
+ (setf *qt-eval* (make-instance 'qt-eval))
+ (qt:do-delayed-initialize [_$_]
hunk ./src/repl.lisp 82
- (qt:exec)))
- :name "Qt Event Loop")
- (bt:with-lock-held (ready-lock)
- (bt:condition-wait ready ready-lock))))
+ (qt:connect (qt:get-signal (qt:app)
+ "aboutToQuit()")
+ #'(lambda ()
+ (setf *qt-eval* nil)))
+ (qt:exec)))
+ :name "Qt Event Loop")
+ (bt:with-lock-held (ready-lock)
+ (bt:condition-wait ready ready-lock)))))
hunk ./src/repl.lisp 104
- ; (swank::handle-requests swank::*emacs-connection* t)
hunk ./src/repl.lisp 106
- ;(curry #'sb-impl::serve-event 0.1))