The following snippet adds support for per-slime-dialect hooks to be called after the connection is established.
A subtle point is that this allows for nice customisation of lisp projects to be run:
(define-slime-dialect "foo" "sbcl" nil (lambda () (cd "/foo/project/path/") (slime-load-file "load-foo.lisp"))) (define-slime-dialect "bar" "sbcl" nil (lambda () (cd "/path/to/bar/project/") (slime-load-file "load-bar.lisp")))
Granted, this could have been arranged for via parameters to sbcl, effectively making an illusion of two "differeng" lisp implementations, but somehow this just feels... cleaner?
(this is against cvs slime) --- slime/slime.el 2006-11-29 04:11:54.000000000 +0300 +++ slime-new/slime.el 2006-11-29 04:07:28.000000000 +0300 @@ -1573,20 +1573,29 @@ (when package (slime-repl-set-package (second package)))))))
-(defmacro define-slime-dialect (name &optional program hook) +(defvar *slime-in-dialect* nil) + +(defmacro define-slime-dialect (name &optional program hook connhook) "Define a command slime-dialect-NAME to start a specific Lisp. PROGRAM is the command to start the inferior process. HOOK is function which is run before the process is started." (let ((funsym (intern (format "slime-dialect-%s" name))) (hooksym (intern (format "slime-dialect-%s-hook" name))) + (connhooksym (intern (format "slime-dialect-%s-connected-hook" name))) (progsym (intern (format "slime-dialect-%s-program" name)))) `(progn (defvar ,progsym ,program) (defvar ,hooksym ,hook) + (defvar ,connhooksym ,connhook) + (add-hook 'slime-connected-hook + (lambda () + (when (equal *slime-in-dialect* ,name) + (run-hooks ',connhooksym)))) (defun ,funsym () ,(format "Start up slime according to `%s'." progsym) (interactive) (let ((inferior-lisp-program ,progsym)) + (setq *slime-in-dialect* ,name) (run-hooks ',hooksym) (call-interactively 'slime))))))