SLIME and in-package

Peter Keller psilord at cs.wisc.edu
Sat Feb 6 07:39:27 UTC 2016


Hello,

I have a question, hopefully easy, but I can't seem to find the answer.

I'd like to evaluate a region which contains something like this:

(asdf:load-system '#:foo)
(in-package #'foo)

and have my slime REPL actually change its current package.

I realize that some problems can happen with the above, which led me
to this page:

http://stackoverflow.com/questions/27095320/common-lisp-how-to-get-in-package-to-work-from-within-emacs-slime

When I rewrite the above to

(eval-when (:compile-toplevel :load-toplevel :execute)
  (asdf:load-ssytem '#:foo))
(in-package #'foo)

It loads the package, but can't change the current REPL package
to it, SLIME continues to say CL-USER.

I also realize that slime may be LOADing the file, which preserves the
current package. Since I get a => <PACKAGE "FOO"> in my *slime-events*
buffer I think that may be also happening.

Is there any way to change the current REPL package by using any SLIME
evaluation methods that involve evaluating a region? Or must I either manually
type (in-package :foo) in the REPL or use the ,in-package SLIME command helper.

I'm just about to write some elisp to take the region, find the slime repl
buffer, manually append the region into the REPL buffer, and enter a return to
execute it! There must be a better way!

Thank you!

-pete



More information about the slime-devel mailing list