[slime-devel] Re: per-slime-dialect slime-connected-hook implementation

Helmut Eller heller at common-lisp.net
Tue Dec 5 14:38:32 UTC 2006


* _deepfire at feelingofgreen.ru [2006-11-29 05:24+0100] writes:

> 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?

define-slime-dialect is semi obsolete.  slime-start in combination
with slime-lisp-implementations should be used instead.

I added a :init-function arg to slime-start which can be used like
your hooks.  Your examples can now be achieved with something like
this:

(setq slime-lisp-implementations
      '((foo ("sbcl") :init-function (lambda ()
                                       (cd "/foo/project/path/")
                                       (slime-load-file "load-foo.lisp")))))

or with a simple function like:

(defun bar ()
  (interactive)
  ;; ... code for pre-hook, if you need that
  (slime-start :program "sbcl" :init-function (lambda () ...)))


Helmut.




More information about the slime-devel mailing list