Helmut Eller wrote:
* Stas Boukarev [2008-09-16 01:35+0200] writes:

  
I don't know what is better: use the previous connection or use the
connection if it is the only remained. The attached patch is doing the
former.
    

I added a customizable variable, slime-auto-select-connection.  The
default is to ask if the connection should be switched.  If you set the
variable to 'always the first connection will be used.
  

I have this in my .emacs file. By pressing F12, I make the default-connection a buffer-local variable.
As I usualy have several differen lisps running at the same time, with different lisp code.

(defun slime-toggle-connection ()
  "Change current slime connection, and make it buffer local"
  (interactive)
  (setf  slime-net-processes (rotate-list slime-net-processes))
  (let ((p (car slime-net-processes)))
    (make-local-variable 'slime-default-connection)
    (slime-select-connection p)
    (message "Lisp: %s, buffer: %s" (process-contact p) (slime-connection-name p))))

(define-key slime-mode-map [f12] 'slime-toggle-connection)
(define-key slime-mode-map [f11] 'slime-goto-current-connection)



--
FreeCode Signature Free Software Consultant
Cell: +47 - 47 34 40 08
Phone: +47 - 21 53 69 00, Fax: +47 - 21 53 69 09
Addr: Nydalsveien 30b, 0484 Oslo