? .xvpics
? before.el
? diff
? diffs
? easy
? slime.asd
? tmp
Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.119
diff -u -Fdefun -r1.119 slime.el
--- slime.el	29 Nov 2003 22:12:09 -0000	1.119
+++ slime.el	30 Nov 2003 21:04:41 -0000
@@ -823,7 +823,7 @@ (defun slime-read-port-and-connect (&opt
           (cond ((file-exists-p (slime-swank-port-file))
                  (let ((port (slime-read-swank-port)))
                    (delete-file (slime-swank-port-file))
-                   (slime-connect "localhost" port)))
+                   (slime-connect/inet "localhost" port)))
                 ((and retries (zerop retries))
                  (message "Failed to connect to Swank."))
                 (t
@@ -832,19 +832,39 @@ (defun slime-read-port-and-connect (&opt
                        (run-with-timer 1 nil #'attempt-connection))))))
       (attempt-connection))))
 
-(defun slime-connect (host port)
+(defun slime-connect-aux (where)
+  (let ((buffer (slime-make-net-buffer " *cl-connection*")))
+    (set-process-buffer slime-net-process buffer)
+    (set-process-filter slime-net-process 'slime-net-filter)
+    (set-process-sentinel slime-net-process 'slime-net-sentinel)
+    (when (fboundp 'set-process-coding-system)
+      (set-process-coding-system slime-net-process 
+                                 'no-conversion 'no-conversion))
+    (slime-init-connection)
+    (when-let (buffer (get-buffer "*inferior-lisp*"))
+      (delete-windows-on buffer)
+      (bury-buffer (get-buffer "*inferior-lisp*")))
+    (pop-to-buffer (slime-output-buffer))
+    (message "Connected to Swank server on %S. %s"
+             where (slime-random-words-of-encouragement)))
+
+(defun slime-connect/inet (host port)
   "Connect to a running Swank server"
   (interactive (list (read-from-minibuffer "Host: " "localhost")
                      (read-from-minibuffer "Port: " "4005" nil t)))
   (message "Connecting to Swank on port %S.." port)
-  (slime-net-connect "localhost" port)
-  (slime-init-connection)
-  (when-let (buffer (get-buffer "*inferior-lisp*"))
-    (delete-windows-on buffer)
-    (bury-buffer (get-buffer "*inferior-lisp*")))
-  (pop-to-buffer (slime-output-buffer))
-  (message "Connected to Swank server on port %S. %s"
-           port (slime-random-words-of-encouragement)))
+  (setq slime-net-process
+        (open-network-stream "SLIME Lisp" nil host port))
+  (slime-connect-aux port))
+
+(defun slime-connect/local (pathname)
+  "Connect to a running Swank server"
+  (interactive (list (read-from-minibuffer "Pathname: " "/tmp/sock")))
+  (message "Connecting to Swank on socket %S.." pathname )
+  (setq slime-net-process
+        (let ((process-connection-type nil)) ; pipe
+          (start-process-shell-command "SLIME Lisp" nil "attachtty" path "2>/dev/null")))
+  (slime-connect-aux pathname))
 
 (defun slime-disconnect ()
   "Disconnect from the Swank server."
@@ -884,19 +904,6 @@ (defun slime-random-words-of-encourageme
 (defvar slime-net-process nil
   "The process (socket) connected to the CL.")
 
-(defun slime-net-connect (host port)
-  "Establish a connection with a CL."
-  (setq slime-net-process
-        (open-network-stream "SLIME Lisp" nil host port))
-  (let ((buffer (slime-make-net-buffer " *cl-connection*")))
-    (set-process-buffer slime-net-process buffer)
-    (set-process-filter slime-net-process 'slime-net-filter)
-    (set-process-sentinel slime-net-process 'slime-net-sentinel)
-    (when (fboundp 'set-process-coding-system)
-      (set-process-coding-system slime-net-process 
-                                 'no-conversion 'no-conversion)))
-  slime-net-process)
-    
 (defun slime-make-net-buffer (name)
   "Make a buffer suitable for a network process."
   (let ((buffer (generate-new-buffer name)))
@@ -1333,7 +1340,7 @@ (defun slime-check-connected ()
 (defun slime-connected-p ()
   "Return true if the Swank connection is open."
   (and slime-net-process
-       (eq (process-status slime-net-process) 'open)))
+       (member (process-status slime-net-process) '(run open))))
 
 (defun slime-eval-string-async (string package continuation)
   (when (slime-busy-p)
Index: swank-sbcl.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-sbcl.lisp,v
retrieving revision 1.31
diff -u -Fdefun -r1.31 swank-sbcl.lisp
--- swank-sbcl.lisp	29 Nov 2003 23:31:29 -0000	1.31
+++ swank-sbcl.lisp	30 Nov 2003 21:04:42 -0000
@@ -61,7 +61,7 @@ (defun without-interrupts* (body)
 
 ;;; TCP Server
 
-(defun open-listener (port reuse-address)
+(defun open-listener/inet (port reuse-address)
   (let ((socket (make-instance 'sb-bsd-sockets:inet-socket
 			       :type :stream
 			       :protocol :tcp)))
@@ -72,24 +72,36 @@ (defun open-listener (port reuse-address
     (sb-bsd-sockets:socket-listen socket 5)
     socket))
 
+(defun open-listener/local (pathname)
+  (let ((socket (make-instance 'sb-bsd-sockets:local-socket
+			       :type :stream)))
+    (setf (sb-bsd-sockets:non-blocking-mode socket) t)
+    (sb-bsd-sockets:socket-bind socket pathname)
+    (sb-bsd-sockets:socket-listen socket 5)
+    socket))
+
 (defun accept (socket)
   "Like socket-accept, but retry on EAGAIN."
   (loop (handler-case
             (return (sb-bsd-sockets:socket-accept socket))
           (sb-bsd-sockets:interrupted-error ()))))
 
-(defun create-swank-server (port &key reuse-address)
-  "Create a SWANK TCP server."
-  (let ((socket (open-listener port reuse-address)))
+(defun create-swank-server (port-or-path &key (af :inet) reuse-address)
+  "Create a SWANK server.  AF may be :INET for a TCP connection, :LOCAL for a local domain socket"
+  (let ((socket (case af
+                  (:inet (open-listener/inet port-or-path reuse-address))
+                  (:local (open-listener/local port-or-path)))))
     (sb-sys:add-fd-handler 
      (sb-bsd-sockets:socket-file-descriptor socket)
      :input (lambda (fd) 
 	      (declare (ignore fd))
 	      (accept-connection socket)))
+    ;; return value kinda meaningless for a unix socket
     (nth-value 1 (sb-bsd-sockets:socket-name socket))))
 
+;;; only works with tcp connection right now
 (defun open-stream-to-emacs ()
-  (let* ((server-socket (open-listener 0 t))
+  (let* ((server-socket (open-listener/inet 0 t))
          (port (nth-value 1 (sb-bsd-sockets:socket-name server-socket))))
     (unwind-protect
          (progn
@@ -106,6 +118,9 @@ (defun accept-connection (server-socket)
   (let* ((socket (accept server-socket))
 	 (stream (sb-bsd-sockets:socket-make-stream 
 		  socket :input t :output t :element-type 'base-char))
+         (*use-dedicated-output-stream*
+          (and *use-dedicated-output-stream* 
+               (typep server-socket 'sb-bsd-sockets:inet-socket)))
          (out (if *use-dedicated-output-stream*
                   (let ((*emacs-io* stream)) (open-stream-to-emacs))
                   (make-instance 'slime-output-stream)))
