Loading a Slime module defined with define-slime-contribs will load its slime-dependencies from anywhere in the Emacs load-path. Swank, however, has its own load-path, so modules with Swank contrib dependencies don't work if they're in a non-default location.
For example, if I have a module containing: (require 'slime)
(define-slime-contrib my-slime-module "My custom Slime module" (:swank-dependencies my-swank-module))
(provides 'my-slime-module)
Then running the following will fail if that module is anywhere other than the default SLIME directory: (require 'my-slime-module) (slime-setup '(my-slime-module))
I've seen two work-arounds, neither of them ideal: 1. Put something in ~/.swank.lisp to modify swank::*load-path*. (That works, but requires more setup and I have to change it if I'm loading from a different directory.) 2. Leave out that dependency from :swank-dependencies and add a hook to 'slime-connected-hook (called after slime-load-contribs) that calls slime-load-file. (That works, but is quite messy.)
Is there a supported way for adding directories to the Swank load-path from SLIME? Should define-slime-contrib have a :swank-paths parameter or something?
Peace, -Sam
On Fri, Aug 01 2014, Samuel Freilich wrote:
[...]
I've seen two work-arounds, neither of them ideal:
- Put something in ~/.swank.lisp to modify swank::*load-path*. (That works,
but requires more setup and I have to change it if I'm loading from a different directory.) 2. Leave out that dependency from :swank-dependencies and add a hook to 'slime-connected-hook (called after slime-load-contribs) that calls slime-load-file. (That works, but is quite messy.)
Is there a supported way for adding directories to the Swank load-path from SLIME?
No; nothing that I know of. 1. doesn't sound so bad to me.
Should define-slime-contrib have a :swank-paths parameter or something?
Something like
(define-slime-contrib foo (:swank-dependencies (bar "/path1/bar.lisp")))
that passes 'bar and "/path1/bar.lisp" to swank:swank-require would be easy to implement.
Not sure if it's worth it, though. Especially as some people want to get rid of swank:swank-require and replace everything with ASDF.
Helmut
Hi,
I had the same problem as you and got suggested to use the branch of slime called "choose-swank-loading-method":
https://github.com/slime/slime/tree/choose-swank-loading-method
You can find the old thread here:
http://comments.gmane.org/gmane.lisp.slime.devel/11430
It basically gives you the possibility to use ASDF for loading swank-related files. Works pretty well and feels clean and elegant. I'm still hoping that one day the "choose-swank-loading-method" branch will get merged into the master :)
Cheers, Gaya
On Sat, Aug 2, 2014 at 8:38 AM, Helmut Eller eller.helmut@gmail.com wrote:
On Fri, Aug 01 2014, Samuel Freilich wrote:
[...]
I've seen two work-arounds, neither of them ideal:
- Put something in ~/.swank.lisp to modify swank::*load-path*. (That
works,
but requires more setup and I have to change it if I'm loading from a different directory.) 2. Leave out that dependency from :swank-dependencies and add a hook to 'slime-connected-hook (called after slime-load-contribs) that calls slime-load-file. (That works, but is quite messy.)
Is there a supported way for adding directories to the Swank load-path
from
SLIME?
No; nothing that I know of. 1. doesn't sound so bad to me.
Should define-slime-contrib have a :swank-paths parameter or something?
Something like
(define-slime-contrib foo (:swank-dependencies (bar "/path1/bar.lisp")))
that passes 'bar and "/path1/bar.lisp" to swank:swank-require would be easy to implement.
Not sure if it's worth it, though. Especially as some people want to get rid of swank:swank-require and replace everything with ASDF.
Helmut
Slime-devel mailing list Slime-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/slime-devel