Now that slime-repl is in contrib, is it true that (setup-slime '(slime-repl)) is necessary to use a remote Lisp process? I see that starting up a lisp, having it load the right stuff and run swank:create-server, and then using M-x slime-connect works if slime-repl is loaded, but I don't see any repl if it is not.
Or is there another recommended way now to use a remote lisp that does not depend on any contrib modules?
Thanks,
Sidney Markowitz http://sidney.com
I posted this information to the Aquamacs-devel list and was asked to post it here.
I was looking at the bug in the inspector in slime-fancy when used with clos objects in LispWorks. The bug was reported here quite a while ago and the latest patch for it was posted in
http://article.gmane.org/gmane.lisp.slime.devel/7415
I won't repost the patch as the one there applies cleanly to current CVS. All it does is define three one line wrapper functions that are available in other lisps or their swank backends but not LispWorks and are used by the fancy inspector for slot write access.
I did confirm that the bug occurs with the current version 5.1 of LispWorks Personal Edition, using SLIME from CVS. While reproducing it I found that the existing documentation for SLIME and LispWorks Personal Edition is no longer accurate, so I am noting what I found here, along with the steps to reproduce the bug.
LispWorks Personal Edition is the free version that has some restrictions, including no ability to start it up from the command line without a GUI (at least on MacOS X, I'm not familiar with it on other platforms), nor to have it load an init file. That prevents it from being started up using M-x slime. The workaround is to start up LispWorks independently and use it as you would any remote lisp with SLIME by having it run a swank server and have emacs use M-x slime-connect.
SLIME now needs a call to (swank-loader:init) after swank-loader is loaded and before swank:create-server is called. Using asdf to load SLIME takes care of that, but the older documented ways for using SLIME with LispWorks did not mention doing that. LispWorks does not come with asdf (or at least the free version doesn't).
I got SLIME working with the following steps. Of course some of these could be automated on using Applescript tricks as Bill Clementson blogged about in 2004, but these are the underlying steps that make it work:
1. Start up LispWorks and then in it load the swank-loader.lisp file from the SLIME distribution.
2. Call (swank-loader:init) Note that if you are putting this into a file that is being loaded you have to play games like (funcall (find-symbol "INIT" :swank-loader)) or (funcall (read-from-string "swank-loader:init")) because the swank-loader package won't be defined yet at read time.
3. Call (swank:create-server) or if you don't want the Lisp to quit when you quit SLIME call (swank:create-server :dont-close t) The same note applies about using funcall to get around the package problem if all this is in a file that you are loading.
4. Emacs should be set up with an initialization file or customization file that adds SLIME's directory to the load path, does a (require 'slime-autoloads) (setup-slime '(slime-repl))
You can start up emacs either before or after starting up the Lisp and swank server.
5. After the swank server is running, in emacs use M-x slime-connect to start up SLIME.
-----------------------
The bug that is mentioned with a patch in http://article.gmane.org/gmane.lisp.slime.devel/7415 affects the object inspector that is loaded by slime-fancy. To reproduce the bug, load up SLIME with (setup-slime '(slime-fancy)) using Lispworks, evaluate the following in the SLIME REPL
(defclass Submarine () ((Depth) (Speed)))
(setq Sub-1 (make-instance 'Submarine)) (setf (slot-value Sub-1 'Depth) 100)
Then use the SLIME menu -> Debugging -> Inspect and tell it to inspect sub-1
This will produce an error
The slot #<STANDARD-EFFECTIVE-SLOT-DEFINITION DEPTH 2008DC2B> is missing from #<SUBMARINE 2008D41F> (of class #<STANDARD-CLASS SUBMARINE 2008E68F>), when reading the value. [Condition of type CONDITIONS::SLOT-MISSING-ERROR]
The patch does seem to fix the bug. The error does not happen if you use a different Lisp other than Lispworks (I tried it using sbcl). It also does not happen if you load slime-repl, whose inspector does not provide a way to modify the contents of slots, only with the additional slot functionality in the inspector in slime-fancy.
I was not able to use Lispworks at all without loading some REPL, whether it was by loading slime-repl or slime-fancy, which prompted my previous question to the mailing list as to whether there is supposed to be a way to use SLIME with a remote Lisp without loading slime-repl.
So, is there a maintainer who is willing to commit the patch to swank-lispworks.lisp?
Thanks,
Sidney Markowitz sidney@sidney.com
On Thu, 15 Jan 2009 18:31:51 +1300, Sidney Markowitz said:
I posted this information to the Aquamacs-devel list and was asked to post it here.
I was looking at the bug in the inspector in slime-fancy when used with clos objects in LispWorks. The bug was reported here quite a while ago and the latest patch for it was posted in
http://article.gmane.org/gmane.lisp.slime.devel/7415
I won't repost the patch as the one there applies cleanly to current CVS. All it does is define three one line wrapper functions that are available in other lisps or their swank backends but not LispWorks and are used by the fancy inspector for slot write access.
Thanks, I've merged this into CVS with minor changes.
I did confirm that the bug occurs with the current version 5.1 of LispWorks Personal Edition, using SLIME from CVS. While reproducing it I found that the existing documentation for SLIME and LispWorks Personal Edition is no longer accurate, so I am noting what I found here, along with the steps to reproduce the bug.
Where is the this documentation kept? I couldn't find anything about LispWorks Personal Edition in the SLIME CVS.
Martin Simmons wrote, On 16/1/09 6:27 AM:
Thanks, I've merged this into CVS with minor changes.
Wonderful!
Where is the this documentation kept? I couldn't find anything about LispWorks Personal Edition in the SLIME CVS.
There isn't specific mention of LispWorks Personal Edition there. When I searched for how to use SLIME with LispWorks Personal Edition what I found was 1) LispWorks 5.1 online documentation that says that SLIME is not supported by LispWorks Personal Edition; 2) Bill Clementson's blog posts that start around 2004 that described how he got SLIME to work with LispWorks 4.3 Personal Edition by starting up LispWorks, starting up a swank server in it, then connecting emacs to that. In other words, using LispWorks Personal Edition like a remote Lisp, which allows SLIME to work even though the Lisp GUI is running. Bill was using it on a Mac and described using Applescript to automate the start up of LispWorks and initial load of a ~/.lispworks file even though the Personal Edition does not provide a way to automatically load an init file; 3) SLIME documentation about running with a remote Lisp.
I guess I should have said that what I gleaned from existing documentation about running SLIME with LispWorks Personal Edition was no longer accurate, as there was no specific documentation for it.
The inaccuracies or missing pieces in the current SLIME documentation about running with a remote Lisp, unless I missed some things, are: No explicit mention that the Lisp needs to load swank-loader.lisp then evaluate (swank-loader:init) then (swank:create-server); No explicit mention that all this is done for you if you use asdf to load swank.asd from SLIME's distribution and then call (swank:create-server); No mention that you have to load slime-repl in setup-slime if you want to run with a remote Lisp because you don't see the Lisp's native REPL when you run that way and slime-repl has been moved out to contrib (Is that accurate, or do I just not know how to get a Lisp's REPL when it is run remotely?).
And I think that the LispWorks documentation could be updated to say that SLIME runs with the Personal Edition only when configured to connect to it as a remote Lisp, not to make the misleading statement that it is "not supported".
While typing this I noticed that the comment in swank.asd still says (swank:create-swank-server) even though the name has been changed to swank:create-server. That should be updated.
Sidney Markowitz http://www.sidney.com
* Sidney Markowitz [2009-01-15 04:19+0100] writes:
Now that slime-repl is in contrib, is it true that (setup-slime '(slime-repl)) is necessary to use a remote Lisp process? I see that starting up a lisp, having it load the right stuff and run swank:create-server, and then using M-x slime-connect works if slime-repl is loaded, but I don't see any repl if it is not.
Well, it's not strictly needed. It just means that you don't have a REPL (and no buffer to see *standard-output*). The other commands, like symbol completion, C-c C-c etc. work as before.
Or is there another recommended way now to use a remote lisp that does not depend on any contrib modules?
If you want a REPL, you have to load it.
Helmut.