emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/slime 04f26df1c3 3/3: Remove dedicated output streams.


From: ELPA Syncer
Subject: [nongnu] elpa/slime 04f26df1c3 3/3: Remove dedicated output streams.
Date: Thu, 2 May 2024 18:59:12 -0400 (EDT)

branch: elpa/slime
commit 04f26df1c3f403c8383df41507929e7bb9b1910c
Author: Stas Boukarev <stassats@gmail.com>
Commit: Stas Boukarev <stassats@gmail.com>

    Remove dedicated output streams.
    
    These are currently broken, but they provide a bad experience:
    asynchronous I/O that cannot be interrupted.
---
 contrib/slime-repl.el                   |  3 --
 contrib/swank-presentation-streams.lisp | 28 ++--------------
 contrib/swank-repl.lisp                 | 57 ++++-----------------------------
 doc/slime.texi                          | 23 -------------
 packages.lisp                           |  2 --
 slime.el                                |  3 +-
 swank.lisp                              |  5 ---
 7 files changed, 10 insertions(+), 111 deletions(-)

diff --git a/contrib/slime-repl.el b/contrib/slime-repl.el
index 3d647739c4..dfb2e07182 100644
--- a/contrib/slime-repl.el
+++ b/contrib/slime-repl.el
@@ -1742,9 +1742,6 @@ expansion will be added to the REPL's history.)"
     ((:read-aborted thread tag)
      (slime-repl-abort-read thread tag)
      t)
-    ((:open-dedicated-output-stream port coding-system)
-     (slime-open-stream-to-lisp port coding-system)
-     t)
     ((:new-package package prompt-string)
      (setf (slime-lisp-package) package)
      (setf (slime-lisp-package-prompt-string) prompt-string)
diff --git a/contrib/swank-presentation-streams.lisp 
b/contrib/swank-presentation-streams.lisp
index 93a6d1d46b..496925cd15 100644
--- a/contrib/swank-presentation-streams.lisp
+++ b/contrib/swank-presentation-streams.lisp
@@ -85,8 +85,7 @@ be sensitive and remember what object it is in the repl if 
predicate is true"
   (defun slime-stream-p (stream)
     "Check if stream is one of the slime streams, since if it isn't we
 don't want to present anything.
-Two special return values: 
-:DEDICATED -- Output ends up on a dedicated output stream
+Special return values: 
 :REPL-RESULT -- Output ends up on the :repl-results target.
 "
     (if (eq last-stream stream)
@@ -107,15 +106,7 @@ Two special return values:
                             (fboundp 'pretty-print::enqueue-annotation)
                             (let ((slime-stream-p
                                    (slime-stream-p 
(pretty-print::pretty-stream-target stream))))
-                              (and ;; Printing through CMUCL pretty
-                                   ;; streams is only cleanly
-                                   ;; possible if we are using the
-                                   ;; bridge-less protocol with
-                                   ;; annotations, because the bridge
-                                   ;; escape sequences disturb the
-                                   ;; pretty printer layout.
-                                   (not (eql slime-stream-p :dedicated-output))
-                                   ;; If OK, return the return value
+                              (and ;; If OK, return the return value
                                    ;; we got from slime-stream-p on
                                    ;; the target stream (could be
                                    ;; :repl-result):
@@ -125,15 +116,12 @@ Two special return values:
                      (declare (notinline sb-pretty::pretty-stream-target))
                      (and (typep stream (find-symbol "PRETTY-STREAM" 
'sb-pretty))
                            (find-symbol "ENQUEUE-ANNOTATION" 'sb-pretty)
-                           (not *use-dedicated-output-stream*)
                            (slime-stream-p (sb-pretty::pretty-stream-target 
stream))))
                    #+allegro
                    (and (typep stream 'excl:xp-simple-stream)
                         (slime-stream-p (excl::stream-output-handle stream)))
                    (loop for connection in *connections*
-                         thereis (or (and (eq stream 
(connection.dedicated-output connection))
-                                          :dedicated)
-                                     (eq stream (connection.socket-io 
connection))
+                         thereis (or (eq stream (connection.socket-io 
connection))
                                      (eq stream (connection.user-output 
connection))
                                      (eq stream (connection.user-io 
connection))
                                      (and (eq stream (connection.repl-results 
connection))
@@ -181,11 +169,6 @@ Two special return values:
     (let ((pid (presentation-record-id record))
          (target (presentation-record-target record)))
       (case target
-       (:dedicated 
-        ;; Use bridge protocol
-        (write-string "<" stream)
-        (prin1 pid stream)
-        (write-string "" stream))
        (t
         (finish-output stream)
         (send-to-emacs `(:presentation-start ,pid ,target)))))
@@ -198,11 +181,6 @@ Two special return values:
     (let ((pid (presentation-record-id record))
          (target (presentation-record-target record)))
       (case target
-       (:dedicated 
-        ;; Use bridge protocol
-        (write-string ">" stream)
-        (prin1 pid stream)
-        (write-string "" stream))
        (t
         (finish-output stream)
         (send-to-emacs `(:presentation-end ,pid ,target)))))))
diff --git a/contrib/swank-repl.lisp b/contrib/swank-repl.lisp
index 210118f7d2..950b12a0a2 100644
--- a/contrib/swank-repl.lisp
+++ b/contrib/swank-repl.lisp
@@ -26,7 +26,6 @@
    connection.user-output
    connection.user-io
    connection.trace-output
-   connection.dedicated-output
    connection.env
 
    multithreaded-connection
@@ -66,24 +65,10 @@
 
    ;; FIXME: those should be exported from swank-repl only, but how to
    ;; do that whithout breaking init files?
-   *use-dedicated-output-stream*
-   *dedicated-output-stream-port*
    *globally-redirect-io*))
 
 (in-package swank-repl)
 
-(defvar *use-dedicated-output-stream* nil
-  "When T swank will attempt to create a second connection to Emacs
-which is used just to send output.")
-
-(defvar *dedicated-output-stream-port* 0
-  "Which port we should use for the dedicated output stream.")
-
-(defvar *dedicated-output-stream-buffering*
-  (if (eq *communication-style* :spawn) t nil)
-  "The buffering scheme that should be used for the output stream.
-Valid values are nil, t, :line")
-
 (defvar *globally-redirect-io* :started-from-emacs
   "When T globally redirect all standard streams to Emacs.
 When :STARTED-FROM-EMACS redirect when launched by M-x slime")
@@ -94,21 +79,16 @@ When :STARTED-FROM-EMACS redirect when launched by M-x 
slime")
     (:started-from-emacs swank-loader:*started-from-emacs*)))
 
 (defun open-streams (connection properties)
-  "Return the 5 streams for IO redirection:
-DEDICATED-OUTPUT INPUT OUTPUT IO REPL-RESULTS"
+  "Return the 4 streams for IO redirection:
+INPUT OUTPUT IO REPL-RESULTS"
   (let* ((input-fn
            (lambda ()
              (with-connection (connection)
                (with-simple-restart (abort-read
                                      "Abort reading input from Emacs.")
                  (read-user-input-from-emacs)))))
-         (dedicated-output (if *use-dedicated-output-stream*
-                               (open-dedicated-output-stream
-                                connection
-                                (getf properties :coding-system))))
          (in (make-input-stream input-fn))
-         (out (or dedicated-output
-                  (make-output-stream (make-output-function connection))))
+         (out (make-output-stream (make-output-function connection)))
          (io (make-two-way-stream in out))
          (repl-results (swank:make-output-stream-for-target connection
                                                             :repl-result)))
@@ -116,7 +96,7 @@ DEDICATED-OUTPUT INPUT OUTPUT IO REPL-RESULTS"
       (multithreaded-connection
        (setf (mconn.auto-flush-thread connection)
              (make-auto-flush-thread out))))
-    (values dedicated-output in out io repl-results)))
+    (values in out io repl-results)))
 
 (defun make-output-function (connection)
   "Create function to send user output to Emacs."
@@ -128,30 +108,6 @@ DEDICATED-OUTPUT INPUT OUTPUT IO REPL-RESULTS"
       ;; processed, most importantly an interrupt-thread request.
       (wait-for-event `(:write-done)))))
 
-(defun open-dedicated-output-stream (connection coding-system)
-  "Open a dedicated output connection to the Emacs on SOCKET-IO.
-Return an output stream suitable for writing program output.
-
-This is an optimized way for Lisp to deliver output to Emacs."
-  (let ((socket (socket-quest *dedicated-output-stream-port* nil))
-        (ef (find-external-format-or-lose coding-system)))
-    (unwind-protect
-         (let ((port (local-port socket)))
-           (encode-message `(:open-dedicated-output-stream ,port
-                                                           ,coding-system)
-                           (connection.socket-io connection))
-           (let ((dedicated (accept-connection
-                             socket
-                             :external-format ef
-                             :buffering *dedicated-output-stream-buffering*
-                             :timeout 30)))
-             (authenticate-client dedicated)
-             (close-socket socket)
-             (setf socket nil)
-             dedicated))
-      (when socket
-        (close-socket socket)))))
-
 (defmethod thread-for-evaluation ((connection multithreaded-connection)
                                  (id (eql :find-existing)))
   (or (car (mconn.active-threads connection))
@@ -218,10 +174,9 @@ This is an optimized way for Lisp to deliver output to 
Emacs."
             (package-string-for-prompt *package*)))))
 
 (defun initialize-streams-for-connection (connection properties)
-  (multiple-value-bind (dedicated in out io repl-results)
+  (multiple-value-bind (in out io repl-results)
       (open-streams connection properties)
-    (setf (connection.dedicated-output connection) dedicated
-          (connection.user-io connection)          io
+    (setf (connection.user-io connection)          io
           (connection.user-output connection)      out
           (connection.user-input connection)       in
           (connection.repl-results connection)     repl-results)
diff --git a/doc/slime.texi b/doc/slime.texi
index 61f3690fdf..cd0361f9ee 100644
--- a/doc/slime.texi
+++ b/doc/slime.texi
@@ -1900,29 +1900,6 @@ the pretty printer for formatting backtraces in @SLDB{}, 
you can use:
 (push '(*print-pretty* . t) swank:*sldb-printer-bindings*).
 @end example
 
-@vindex SWANK:*USE-DEDICATED-OUTPUT-STREAM*
-@item SWANK:*USE-DEDICATED-OUTPUT-STREAM*
-This variable controls whether to use an unsafe efficiency hack for
-sending printed output from Lisp to Emacs.  The default is @code{nil},
-don't use it, and is strongly recommended to keep.
-
-When @code{t}, a separate socket is established solely for Lisp to send
-printed output to Emacs through, which is faster than sending the output
-in protocol-messages to Emacs.  However, as nothing can be guaranteed
-about the timing between the dedicated output stream and the stream of
-protocol messages, the output of a Lisp command can arrive before or
-after the corresponding REPL results.  Thus output and REPL results can
-end up in the wrong order, or even interleaved, in the REPL buffer.
-Using a dedicated output stream also makes it more difficult to
-communicate to a Lisp running on a remote host via SSH
-(@pxref{Connecting to a remote lisp}).
-
-@vindex SWANK:*DEDICATED-OUTPUT-STREAM-PORT*
-@item SWANK:*DEDICATED-OUTPUT-STREAM-PORT*
-When @code{*USE-DEDICATED-OUTPUT-STREAM*} is @code{t} the stream will
-be opened on this port. The default value, @code{0}, means that the
-stream will be opened on some random port.
-
 @vindex SWANK:*LOG-EVENTS*
 @item SWANK:*LOG-EVENTS*
 Setting this variable to @code{t} causes all protocol messages
diff --git a/packages.lisp b/packages.lisp
index 9c21982714..aff8aeea51 100644
--- a/packages.lisp
+++ b/packages.lisp
@@ -154,8 +154,6 @@
            #:*dont-close*
            #:*fasl-pathname-function*
            #:*log-events*
-           #:*use-dedicated-output-stream*
-           #:*dedicated-output-stream-port*
            #:*configure-emacs-indentation*
            #:*readtable-alist*
            #:*globally-redirect-io*
diff --git a/slime.el b/slime.el
index 51dc017d2a..958f3adfff 100644
--- a/slime.el
+++ b/slime.el
@@ -1603,8 +1603,7 @@ This is more compatible with the CL reader."
 ;;; with. Typically there would only be one, but a user can choose to
 ;;; connect to many Lisps simultaneously.
 ;;;
-;;; A connection consists of a control socket, optionally an extra
-;;; socket dedicated to receiving Lisp output (an optimization), and a
+;;; A connection consists of a control socket and a
 ;;; set of connection-local state variables.
 ;;;
 ;;; The state variables are stored as buffer-local variables in the
diff --git a/swank.lisp b/swank.lisp
index 440f1ebf46..ab742fda8a 100644
--- a/swank.lisp
+++ b/swank.lisp
@@ -145,9 +145,6 @@ Backend code should treat the connection structure as 
opaque.")
   ;; Character I/O stream of socket connection.  Read-only to avoid
   ;; race conditions during initialization.
   (socket-io        (missing-arg) :type stream :read-only t)
-  ;; Optional dedicated output socket (backending `user-output' slot).
-  ;; Has a slot so that it can be closed with the connection.
-  (dedicated-output nil :type (or stream null))
   ;; Streams that can be used for user interaction, with requests
   ;; redirected to Emacs.
   (user-input       nil :type (or stream null))
@@ -916,8 +913,6 @@ The processing is done in the extent of the toplevel 
restart."
             (escape-non-ascii (safe-condition-message condition)))
     (stop-serving-requests c)
     (close (connection.socket-io c))
-    (when (connection.dedicated-output c)
-      (ignore-errors (close (connection.dedicated-output c))))
     (setf *connections* (remove c *connections*))
     (run-hook *connection-closed-hook* c)
     (when (and condition (not (typep condition 'end-of-file)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]