SLIME Tips

This page is for collecting tips for avoiding problems with and making the best use of SLIME, the Emacs-based Lisp development environment


Can anyone say whether it's possible to use SLIME in conjunction with attachtty? In particular, I'm wanting to connect to a Linux box running CMUCL/detachtty from my Mac running OS X. attachtty from the command line works fine, but that's not terribly useful. :-) Trying to use SLIME just specifying
inferior-lisp-mode
as the attachtty command line results in numerous errors which appear to be from SLIME trying to load its files (locally in /Users/me/whatever) on the Linux box (obviously they aren't there).

Actually, you don't even need detachtty. But still I prefer to use it, so that I can attach back to it if something breaks even the swank server (e.g. entering the debugger). You have to add something like the following to your application:

(swank:create-server)
Then you can use SLIME's slime-connect command.

Patch for using the asdf output path for all your fasls.

Index: swank-allegro.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-allegro.lisp,v
retrieving revision 1.119
diff -u -p -r1.119 swank-allegro.lisp
--- swank-allegro.lisp	21 Oct 2008 20:38:05 -0000	1.119
+++ swank-allegro.lisp	5 Jan 2009 04:39:08 -0000
@@ -290,6 +290,7 @@
     (let ((*buffer-name* nil)
           (*compile-filename* filename))
       (compile-file *compile-filename* :load-after-compile load-p
+                    :output-file (swank::swank-compile-output-file filename)
                     :external-format external-format))))
 
 (defun call-with-temp-file (fn)
Index: swank-clisp.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-clisp.lisp,v
retrieving revision 1.84
diff -u -p -r1.84 swank-clisp.lisp
--- swank-clisp.lisp	19 Oct 2008 20:03:34 -0000	1.84
+++ swank-clisp.lisp	5 Jan 2009 04:39:08 -0000
@@ -628,7 +628,7 @@ Execute BODY with NAME's function slot s
   (with-compilation-hooks ()
     (with-compilation-unit ()
       (multiple-value-bind (fasl-file warningsp failurep)
-          (compile-file filename :external-format external-format)
+          (compile-file filename :output-file (swank::swank-compile-output-file filename) :external-format external-format)
         (values fasl-file warningsp
                 (or failurep 
                     (and load-p 
Index: swank-lispworks.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-lispworks.lisp,v
retrieving revision 1.123
diff -u -p -r1.123 swank-lispworks.lisp
--- swank-lispworks.lisp	31 Oct 2008 14:13:19 -0000	1.123
+++ swank-lispworks.lisp	5 Jan 2009 04:39:08 -0000
@@ -421,6 +421,7 @@ Return NIL if the symbol is unbound."
 (defimplementation swank-compile-file (filename load-p external-format)
   (with-swank-compilation-unit (filename)
     (compile-file filename :load load-p 
+                  :output-file (swank::swank-compile-output-file filename)
                   :external-format external-format)))
 
 (defvar *within-call-with-compilation-hooks* nil
Index: swank-openmcl.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-openmcl.lisp,v
retrieving revision 1.144
diff -u -p -r1.144 swank-openmcl.lisp
--- swank-openmcl.lisp	19 Oct 2008 20:03:34 -0000	1.144
+++ swank-openmcl.lisp	5 Jan 2009 04:39:08 -0000
@@ -266,7 +266,8 @@ condition."
   (with-compilation-hooks ()
     (let ((*buffer-name* nil)
           (*buffer-offset* nil))
-      (compile-file filename :load load-p))))
+      (compile-file filename :load load-p
+                  :output-file (swank-compile-output-file filename)))))
 
 (defimplementation frame-var-value (frame var)
   (block frame-var-value
Index: swank-sbcl.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-sbcl.lisp,v
retrieving revision 1.227
diff -u -p -r1.227 swank-sbcl.lisp
--- swank-sbcl.lisp	30 Oct 2008 09:28:51 -0000	1.227
+++ swank-sbcl.lisp	5 Jan 2009 04:39:09 -0000
@@ -478,7 +478,7 @@ compiler state."
   (handler-case
       (multiple-value-bind (output-file warnings-p failure-p)
           (with-compilation-hooks ()
-            (compile-file pathname :external-format external-format))
+            (compile-file pathname :output-file (swank::swank-compile-output-file pathname)  :external-format external-format))
         (values output-file warnings-p
                 (or failure-p
                     (when load-p
Index: swank.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank.lisp,v
retrieving revision 1.610
diff -u -p -r1.610 swank.lisp
--- swank.lisp	22 Nov 2008 15:14:51 -0000	1.610
+++ swank.lisp	5 Jan 2009 04:39:09 -0000
@@ -3474,4 +3474,10 @@ Collisions are caused because package in
 (defun init ()
   (run-hook *after-init-hook*))
 
+(defun swank-compile-output-file (pathname)
+  (values-list (asdf:output-files (make-instance 'asdf:compile-op) 
+                            (make-instance 'asdf:cl-source-file :name (pathname-name pathname)
+                                           :parent (make-instance 'asdf:module :pathname nil :name "")
+                                           :pathname nil))))
+
 ;;; swank.lisp ends here
\ No newline at end of file
cvs diff: Diffing contrib
cvs diff: Diffing doc
fremlin@wheeler:~/.emacs.d/packages/slime$ cvs diff -u -p
cvs diff: Diffing .
Index: swank-allegro.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-allegro.lisp,v
retrieving revision 1.119
diff -u -p -r1.119 swank-allegro.lisp
--- swank-allegro.lisp	21 Oct 2008 20:38:05 -0000	1.119
+++ swank-allegro.lisp	5 Jan 2009 04:39:31 -0000
@@ -290,6 +290,7 @@
     (let ((*buffer-name* nil)
           (*compile-filename* filename))
       (compile-file *compile-filename* :load-after-compile load-p
+                    :output-file (swank-compile-output-file filename)
                     :external-format external-format))))
 
 (defun call-with-temp-file (fn)
Index: swank-backend.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-backend.lisp,v
retrieving revision 1.163
diff -u -p -r1.163 swank-backend.lisp
--- swank-backend.lisp	2 Nov 2008 12:05:13 -0000	1.163
+++ swank-backend.lisp	5 Jan 2009 04:39:31 -0000
@@ -1163,5 +1163,10 @@ SPEC can be:
   "Save a heap image to the file FILENAME.
 RESTART-FUNCTION, if non-nil, should be called when the image is loaded.")
 
+(defun swank-compile-output-file (pathname)
+  (values-list (asdf:output-files (make-instance 'asdf:compile-op) 
+                            (make-instance 'asdf:cl-source-file :name (pathname-name pathname)
+                                           :parent (make-instance 'asdf:module :pathname nil :name "")
+                                           :pathname nil))))
 
   
\ No newline at end of file
Index: swank-clisp.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-clisp.lisp,v
retrieving revision 1.84
diff -u -p -r1.84 swank-clisp.lisp
--- swank-clisp.lisp	19 Oct 2008 20:03:34 -0000	1.84
+++ swank-clisp.lisp	5 Jan 2009 04:39:31 -0000
@@ -628,7 +628,7 @@ Execute BODY with NAME's function slot s
   (with-compilation-hooks ()
     (with-compilation-unit ()
       (multiple-value-bind (fasl-file warningsp failurep)
-          (compile-file filename :external-format external-format)
+          (compile-file filename :output-file (swank-compile-output-file filename) :external-format external-format)
         (values fasl-file warningsp
                 (or failurep 
                     (and load-p 
Index: swank-lispworks.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-lispworks.lisp,v
retrieving revision 1.123
diff -u -p -r1.123 swank-lispworks.lisp
--- swank-lispworks.lisp	31 Oct 2008 14:13:19 -0000	1.123
+++ swank-lispworks.lisp	5 Jan 2009 04:39:31 -0000
@@ -421,6 +421,7 @@ Return NIL if the symbol is unbound."
 (defimplementation swank-compile-file (filename load-p external-format)
   (with-swank-compilation-unit (filename)
     (compile-file filename :load load-p 
+                  :output-file (swank-compile-output-file filename)
                   :external-format external-format)))
 
 (defvar *within-call-with-compilation-hooks* nil
Index: swank-openmcl.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-openmcl.lisp,v
retrieving revision 1.144
diff -u -p -r1.144 swank-openmcl.lisp
--- swank-openmcl.lisp	19 Oct 2008 20:03:34 -0000	1.144
+++ swank-openmcl.lisp	5 Jan 2009 04:39:31 -0000
@@ -266,7 +266,8 @@ condition."
   (with-compilation-hooks ()
     (let ((*buffer-name* nil)
           (*buffer-offset* nil))
-      (compile-file filename :load load-p))))
+      (compile-file filename :load load-p
+                  :output-file (swank-compile-output-file filename)))))
 
 (defimplementation frame-var-value (frame var)
   (block frame-var-value
Index: swank-sbcl.lisp
===================================================================
RCS file: /project/slime/cvsroot/slime/swank-sbcl.lisp,v
retrieving revision 1.227
diff -u -p -r1.227 swank-sbcl.lisp
--- swank-sbcl.lisp	30 Oct 2008 09:28:51 -0000	1.227
+++ swank-sbcl.lisp	5 Jan 2009 04:39:32 -0000
@@ -478,7 +478,7 @@ compiler state."
   (handler-case
       (multiple-value-bind (output-file warnings-p failure-p)
           (with-compilation-hooks ()
-            (compile-file pathname :external-format external-format))
+            (compile-file pathname :output-file (swank-compile-output-file pathname)  :external-format external-format))
         (values output-file warnings-p
                 (or failure-p
                     (when load-p


This page is linked from: LispBox   SLIME  

CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively