
Peter Seibel <peter@javamonkey.com> writes:
Here's a patch containing some code I wrote to support running multiple simultaneous SLIME connections to different Lisp implementations. I think I made about as good use of the existing infrastructure as I could but may have missed something.
Nice work! It's good that someone who actually uses the functionality also writes code.
(Speaking of which, is there a reason certain buffer local vars (e.g. slime-connection-number) aren't defined with slime-def-connection-var?)
Probably just an oversight.
+(defmacro* slime-with-chosen-connection ((n) &rest body) + "Make the connection choosen by a universal argument current." + `(let ((slime-buffer-connection (slime-get-named-connection ,n slime-buffer-connection))) + ,@body))
I changed this a bit, so that the 'current-prefix-arg' is used. This way we don't have to modify the signatures of other functions.
+(slime-def-connection-var slime-lisp-implementation-type-name nil + "The short name for the implementation type of the Lisp process.")
We could call this slime-connection-name and use a similar naming scheme as Emacs uses for buffer names, so that we can have multiple connections to Lisps of the same type.
+(defun slime-switch-to-repl (p) + "Switch to the REPL. With a prefix arg, prompt for a named REPL." + (interactive "p") + (cond + ((= p 1) + (slime-switch-to-output-buffer)) + ((or (= p 4) (= p 16)) + (switch-to-buffer + (slime-find-connection-buffer-by-type-name (slime-read-lisp-implementation-type-name))) + (if (= p 16) (slime-make-default-connection)))))
I merged this into slime-switch-to-output-buffer.
+(defun slime-read-lisp-implementation-type-name () + (let ((default (slime-lisp-implementation-type-name))) + (completing-read + (format "Name (default %s): " default) + (mapcar #'(lambda (p) (let ((slime-dispatching-connection p)) (slime-with-connection-buffer (p) (list (slime-lisp-implementation-type-name))))) slime-net-processes) + nil + t + nil + nil + default)))
Please use fewer than 80 characters per line.
+(defslimefun lisp-implementation-type-name () + #+cmu "cmu" + #+sbcl "sbcl" + #+openmcl "openmcl" + #+lispworks "lispworks" + #+allegro "allegro" + #+clisp "clisp")
No, no, no. This style is taboo. The proper way is to define a new interface function and to implement it in the implementation specific file. I'll ask Erik Enge to give you CVS write permissions. Helmut.