[slime-devel] [PATCH] Output redirection in the SIMPLE-SERVE-EVENTS case.

Samium Gromoff _deepfire at feelingofgreen.ru
Wed May 13 20:45:01 UTC 2009


Good day folks,

The following patch fixes the *standard-output* not being redirected
into the *slime-repl* buffer on SBCL/win32 specifically, and in
all cases when connection communication style is NIL, in general.

The problem appeared in the CVS commit dated 2008-12-24 11:14:06,
which moved environment capture past the point where the event handlers
were entering the binding of the stream variables, which is set
from the environment.

The fix was tested on Linux/x86/SBCL-1.0.22 and MinGW/SBCL-1.0.28.43.

commit 87cd4f6167e0b9695a279d8c64e1f4876a001e0a
Author: Samium Gromoff <_deepfire at feelingofgreen.ru>
Date:   Wed May 13 23:44:52 2009 +0400

    Capture stream globals before the request servers are called.

diff --git a/swank.lisp b/swank.lisp
index a0646c2..90418f2 100644
--- a/swank.lisp
+++ b/swank.lisp
@@ -1408,6 +1408,16 @@ The processing is done in the extent of the toplevel restart."
                                       :serve-requests #'simple-serve-requests))
                     )))
            (setf (connection.communication-style c) style)
+           (initialize-streams-for-connection c)
+           (with-struct* (connection. @ c)
+             (setf (@ env)
+                   `((*standard-output* . ,(@ user-output))
+                     (*standard-input*  . ,(@ user-input))
+                     (*trace-output*    . ,(or (@ trace-output) (@ user-output)))
+                     (*error-output*    . ,(@ user-output))
+                     (*debug-io*        . ,(@ user-io))
+                     (*query-io*        . ,(@ user-io))
+                     (*terminal-io*     . ,(@ user-io)))))
            (setf success t)
            c)
       (unless success
@@ -1569,16 +1579,7 @@ NIL if streams are not globally redirected.")
 (defslimefun create-repl (target)
   (assert (eq target nil))
   (let ((conn *emacs-connection*))
-    (initialize-streams-for-connection conn)
     (with-struct* (connection. @ conn)
-      (setf (@ env)
-            `((*standard-output* . ,(@ user-output))
-              (*standard-input*  . ,(@ user-input))
-              (*trace-output*    . ,(or (@ trace-output) (@ user-output)))
-              (*error-output*    . ,(@ user-output))
-              (*debug-io*        . ,(@ user-io))
-              (*query-io*        . ,(@ user-io))
-              (*terminal-io*     . ,(@ user-io))))
       (maybe-redirect-global-io conn)
       (when (use-threads-p)
         (setf (@ repl-thread) (spawn-repl-thread conn "repl-thread")))


regards, Samium Gromoff




More information about the slime-devel mailing list