Panagiotis Papasotiriou <p.j.papasot at gmail.com> writes:
> As far I can tell, "Slime" is
> the Emacs package for Lisp programming. I installed Slime and SBCL (directly
> from Debian GNU/Linux repositories) but somehow those two are not connected,
> so I cannot, for example, mark a region of a Lisp program and execute it in
> SBCL with keystrokes like C-c C-b, as I do with Maxima programs. In fact,
> the Lisp program edited in Emacs seems completely on its own, not connected
> with SBCL in any way, although Slime is supposed to support SBCL. I tried
> several solutions which I found on the Internet, suggesting adding things in
> .emacs configuration file. However, none of those suggestions worked. So my
> question is, which is the "best" Lisp implementation I should use for
> Maxima-oriented Lisp programming, and how can I use it in Emacs?
You don't provide much information about how you started slime, so it is
difficult to say what is happening. However, my experience with debian
and slime+sbcl is that slime sometimes gets confused during
start-up--but it tells you what it is confused about in the
*inferior-lisp* buffer. I can usually resolve the problem on the command
line in that buffer and resume, or in the grimmest cases killing slime
and restarting will work fine.
Anyhow, here is some emacs lisp code I use to run a Maxima lisp image
inside a slime session. A while ago I had to add the SBCL_HOME bit in
order for sbcl to start properly.
;; see
;; http://common-lisp.net/pipermail/slime-devel/2009-December/017018.html
;; for an explanation of this function
(defun load-swank-dont-close (port-filename encoding)
(format "%S\n\n"
`(progn
(load ,(expand-file-name slime-backend slime-path) :verbose
t)
(funcall (read-from-string "swank-loader:init"))
(funcall (read-from-string "swank:start-server")
,port-filename
:coding-system ,(slime-coding-system-cl-name
encoding)
:dont-close t))))
;; Set Lisps
(setq slime-lisp-implementations
'((cmucl ("cmucl" "-quiet") :init load-swank-dont-close)
(clisp ("/usr/bin/clisp") :init load-swank-dont-close)
(sbcl ("sbcl" "-quiet") :init load-swank-dont-close)
(maxima-5.25.1-sbcl
("sbcl" "--core"
"/usr/local/lib/maxima/5.25.1/binary-sbcl/maxima.core" "--noinform"
"--end-runtime-options" "--eval" "(cl-user::run)"
"--end-toplevel-options" "--init=/dev/null")
:init-function slime-init-fn-msbcl
:env ("SBCL_HOME=/usr/lib/sbcl")
:init slime-maxima-init
)))
;; helper functions to switch Maxima into the Lisp reader and select the package
(defun slime-init-fn-msbcl ()
(insert "(in-package :maxima)\n"))
(defun slime-maxima-init (p e)
(concat "to_lisp();\n(in-package :cl-user)\n" (load-swank-dont-close p e) "\n"))
HTH
--
Leo Butler <l_butler at users.sourceforge.net>
SDF Public Access UNIX System - http://sdf.lonestar.org