[slime-cvs] CVS update: slime/swank.lisp

Helmut Eller heller at common-lisp.net
Sat Feb 21 07:35:12 UTC 2004


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv10096

Modified Files:
	swank.lisp 
Log Message:
(process-available-input): Move auxiliary function to toplevel.  Test
if the stream is open.
(install-sigio-handler): Handle the first request after installing the
signal handler.

Date: Sat Feb 21 02:35:12 2004
Author: heller

Index: slime/swank.lisp
diff -u slime/swank.lisp:1.121 slime/swank.lisp:1.122
--- slime/swank.lisp:1.121	Tue Feb 17 16:54:36 2004
+++ slime/swank.lisp	Sat Feb 21 02:35:12 2004
@@ -88,7 +88,6 @@
   (declare (ignore depth))
   (print-unreadable-object (connection stream :type t :identity t)))
 
-
 (defvar *emacs-connection* nil
   "The connection to Emacs.
 All threads communicate through this interface with Emacs.")
@@ -407,19 +406,21 @@
                         :send #'send-to-socket-io
                         :serve-requests #'simple-serve-requests)))))
 
+(defun process-available-input (stream fn)
+  (loop while (and (open-stream-p stream) 
+                   (listen stream))
+        do (funcall fn)))
+
 (defun install-sigio-handler (connection)
   (let ((client (connection.socket-io connection)))
-    (labels ((process-available-input (fn)
-               (loop do (funcall fn)
-                     while (listen client)))
-             (handler ()   
-               (cond ((null *swank-state-stack*)
-                      (with-reader-error-handler (connection)
-                        (process-available-input #'handle-request)))
-                     ((eq (car *swank-state-stack*) :read-next-form))
-                     (t (process-available-input #'read-from-emacs)))))
-      (handler)
-      (add-input-handler client #'handler))))
+    (flet ((handler ()   
+             (cond ((null *swank-state-stack*)
+                    (with-reader-error-handler (connection)
+                      (process-available-input client #'handle-request)))
+                   ((eq (car *swank-state-stack*) :read-next-form))
+                   (t (process-available-input client #'read-from-emacs)))))
+      (add-input-handler client #'handler)
+      (handler))))
 
 (defun remove-sigio-handler (connection)
   (remove-input-handlers (connection.socket-io connection)))





More information about the slime-cvs mailing list