2

I am in the process of configuring slime for emacs. So far I have read about basic functionality for common lisp such as C-c C-q which invokes the command slime-close-parens-at-point which places the proper number of parens where your mouse is. Another command that seemed cool was invoked by C-c C-c and it would pass the code you are editing in a buffer to the REPL, and "compile" it.

Why won't these commands work for me?

Anyway, I have downloaded slime via M-x list-packages and do not seem to have this functionality (C-h w and then any of these commands tells me that these commands do note exist). So, I saw a bunch of other slime extensions such as slime-repl', 'slime-fuzzy' and 'hippie-expand-slime'. So I again usedM-x list-packages` and downloaded them.

Still I did not have these commands. Here is the content of my emacs file relevant to slime:

;;;Common Lisp and Slime                                                                                                                                
(add-to-list 'load-path "/home/s2s2/.emacs.d/elpa/slime-20130626.1151")
(add-to-list 'load-path "/home/s2s2/.emacs.d/elpa/slime-repl-201000404")
(add-to-list 'load-path "/home/s2s2/.emacs.d/elpa/hippie-expand-slime-20130226.1656")
(add-to-list 'load-path "/home/s2s2/.emacs.d/elpa/slime-fuzzy-20100404")

(require 'slime)
(setq slime-lisp-implementations
     `((sbcl ("/usr/bin/sbcl"))
       (ecl ("/usr/bin/ecl"))
       (clisp ("/usr/bin/clisp" "-q -I"))))

(require 'slime-repl)
(require 'slime-fuzzy)
(require 'hippie-expand-slime)

When I execute M-x slime I get the following message in the inferior-lisp buffer where I can execute common lisp code (however, shouldn't this be the slime-repl since I required it?):

STYLE-WARNING: redefining EMACS-INSPECT (#<BUILT-IN-CLASS T>) in DEFMETHOD
STYLE-WARNING:
   Implicitly creating new generic function STREAM-READ-CHAR-WILL-HANG-P.
WARNING: These Swank interfaces are unimplemented:
 (DISASSEMBLE-FRAME SLDB-BREAK-AT-START SLDB-BREAK-ON-RETURN)
;; Swank started at port: 46533.

Then a slime-error buffer is created with the contents:

Invalid protocol message:
Symbol "CREATE-REPL" not found in the SWANK package.

  Line: 1, Column: 28, File-Position: 28

  Stream: #<SB-IMPL::STRING-INPUT-STREAM {10056B9C33}>

(:emacs-rex (swank:create-repl nil) "COMMON-LISP-USER" t 5)
  1. How should I modify my emacs file to give me the functionality of those commands? In my emacs file am I not loading the necessary files? Do I need to install an additional package?

If you need more information let me know! All help is much appreciated!

1 Answer 1

0

First: It's not really recommended to add ELPA directories to your load path by hand, in the fashion you've done; if you ever update those packages through ELPA, the new versions will be in different directories, and you'll have to revisit this part of your init code to load those versions instead. On the principle that it's best to automate as much as possible, you're better off explicitly initializing the package manager, which will automatically add all your installed packages to the load path, rather than waiting for it to initialize after init as is the default; see this answer for how that's done.

Now, then: I'm not sure where I got this stanza of initialization code for Slime, but it has never failed me yet:

(add-to-list 'load-path (expand-file-name "~/.emacs.d/site-lisp/slime"))
(require 'slime)
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
(setq inferior-lisp-program "sbcl")
(slime-setup '(slime-fancy slime-asdf))

That said, I only use SBCL, and I see you use multiple implementations. Probably the best way to modify this init code for your case would be something like this:

(require 'slime)
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
(setq slime-lisp-implementations
  `((sbcl ("/usr/bin/sbcl"))
   (ecl ("/usr/bin/ecl"))
   (clisp ("/usr/bin/clisp" "-q -I"))))
(slime-setup '(slime-fancy slime-asdf hippie-expand-slime))

Since you've already initialized the package manager per my previous comments, there's no need to explicitly add anything to the load path; since you use several Lisps, we replace the (setq inferior-lisp-program "...") as well.

With this in place, M-x slime will invoke SBCL and give you a REPL, &c., while M-- M-x slime will prompt for which Lisp implementation to invoke.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .