Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add slime-connect-unix #1485

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions extensions/lisp-mode/lisp-mode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,29 @@
(when start-repl (start-lisp-repl))
(connected-slime-message connection)))

#+sbcl
(define-command slime-connect-unix (socket-path &optional (start-repl t))
((:splice
(list (prompt-for-string "Hostname: " :initial-value "/tmp/micros.sock"))))
(let ((connection (progn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a docstring?

(log:debug "Connecting to SWANK using UNIX socket")
(let* ((sock (make-instance 'sb-bsd-sockets:local-socket :type :stream))
(_ (sb-bsd-sockets:socket-connect sock socket-path))
(stream (sb-bsd-sockets:socket-make-stream sock :element-type '(unsigned-byte 8) :input t :output t))
(socket (usocket::make-stream-socket :socket sock :stream stream))
(connection (make-instance 'connection
:hostname socket-path
:port 0
:socket socket)))
(declare (ignore _))
(lem-lisp-mode/swank-protocol::setup connection)
connection))))
(add-and-change-connection connection)
(start-thread)
(when start-repl (start-lisp-repl))
(connected-slime-message connection)))


(defun pull-events ()
(when (connected-p)
(handler-case (loop :while (message-waiting-p (current-connection))
Expand Down
Loading