reconnecting and *GLOBALLY-REDIRECT-IO*

Luís Oliveira luismbo at gmail.com
Mon Nov 23 22:52:33 UTC 2015


On Mon, Nov 23, 2015 at 4:18 PM, Gábor Melis <mega at retes.hu> wrote:
> Then switch to *slime-scratch* and evaluate with C-x C-e the loop
> form. The output goes to the repl regardless of
> *globally-redirect-io*. Now disconnect, reconnect and there is no more
> output although the thread is still there.

Right, so what happens in that scenario is that a thread is spawned
via SWANK::SPAWN-WORKER-THREAD to handle the C-x C-e request and
eventually calls SWANK::WITH-IO-REDIRECTION which will bind the
various stream variables to the specific REPL stream created for the
current connection.

I've attached a tentative fix for your use case.

I'll have to think a little bit about the broader implications. Can
you tell me a bit more about how your use case came about? That might
help.

Cheers,

-- 
Luís Oliveira
http://kerno.org/~luis/
-------------- next part --------------
diff --git a/contrib/swank-repl.lisp b/contrib/swank-repl.lisp
index 5bf629a..deeeb4b 100644
--- a/contrib/swank-repl.lisp
+++ b/contrib/swank-repl.lisp
@@ -193,14 +193,15 @@ This is an optimized way for Lisp to deliver output to Emacs."
   (let ((conn *emacs-connection*))
     (initialize-streams-for-connection conn `(:coding-system ,coding-system))
     (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))))
+      (unless *globally-redirect-io*
+        (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)
       (add-hook *connection-closed-hook* 'update-redirection-after-close)
       (typecase conn


More information about the slime-devel mailing list