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)
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?
Or if you have better ideas let me know!
If you need more information let me know! All help is much appreciated!
Swank is the server in common lisp (in your case, it's SBCL) as the backend of SLIME. SLIME is the frontend in emacs lisp.
slime-repl won't work by itself, it needs the corresponding plugin at the server side. You should ensure that there is swank-repl.lisp in the directory of swank. It's swank-repl.lisp including the "CREATE-REPL" function.
Your slime-repl doesn't work. So you cannot see the *slime-repl* buffer in emacs.
I prefer to use SLIME from the its official GIT repo (https://github.com/slime/slime).
Related
I am new to Lisp, and working in Emacs with Slime, I am constantly getting this error
Error: The variable SWANK/SBCL::*SWANK-DEBUGGER-CONDITION* is unbound.
I have spent a long time googling this and can find no reference to that variable. What is it? And what is it supposed to be bound to?
It seems that is an issue with your version of slime:
https://github.com/slime/slime/issues/320
SO use the late slime confi with
Quicklisp-slime-helper makes it easy to use SLIME from Quicklisp.
To use it, load quicklisp in your Common Lisp implementation, then
evaluate:
(ql:quickload "quicklisp-slime-helper")
That command will create a file in the Quicklisp base directory called
"slime-helper.el". Loading that file will add the Quicklisp slime path
to your Emacs load-path.
In your ~/.emacs, you could have something like this:
(load (expand-file-name "~/quicklisp/slime-helper.el")) (setq
inferior-lisp-program "sbcl")
quicklisp-slime-helper is available under the MIT license; see
LICENSE.txt for details.
I am trying to configure emacs24 on my Ubuntu 15.10 laptop. I have both SBCL and CLISP installed (and both will run from the command line just fine). I have Slime installed, and I configured the .emacs file thus:
(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime/")
(setq inferior-lisp-program "/usr/bin/clisp")
(require 'slime)
(slime-setup)
With Emacs24 running I hit M-x slime and slime starts up, but it's running SBCL, not CLISP. I don't understand why it's ignoring the inferior-lisp-program line. I know that Emacs24 is reading the .emacs file because if I delete everything in the file slime won't run at all. It just doesn't seem to care how I set setq.
I've double checked my paths and both slime and clisp are where the path descriptions indicate. Very confusing! Any help would be greatly appreciated.
How to install the slime into emacs under Win7?
I download a compact package with '.tgz'. But it seems for linux. But there is really not one thing for windows(win 32 OS).
I unfold this package and I find there are lots of documents.
It's actually the same as for other operating systems, as far as I can tell. (At least, it always worked for me under FreeBSD/ArchLinux/Win7.) First, you unpack to a location you like, then add something like this to your .emacs (assuming you unpacked somewhere under your user directory):
(add-to-list 'load-path "~/my/path/to/slime/")
;; (add-to-list 'load-path "~/my/path/to/slime/contrib/") ; for optional features
(slime-setup
;; '(slime-fancy slime-asdf slime-references ; optional features
;; slime-indentation slime-xref-browser)
)
(setq slime-lisp-implementations
'((ccl ("~/path/to/ccl/wx86cl"))
(clisp ("~/path/to/clisp-2.49/clisp" "-modern"))) ; giving a command arg
slime-default-lisp 'ccl)
Restart Emacs or type C-x C-e behind each of these toplevel forms. Then, type M-x slime RET (or C-u M-x slime RET if you want to choose between the implementations in slime-lisp-implementations, otherwise slime-lisp-default will be used) and it should just work (it does for me). The setting of slime-lisp-implementations is optional – you can also give the path to your lisp implementation executable by hand when starting Slime.
Assuming you want to use Slime with CL, since there is no Clojure tag. If you want to use it with Clojure, things are unfortunately a little different and both versions don't play very nicely together. The recommended way for use with Clojure, last time I checked, would be installation using the package system of Emacs 24 or, if you're using an older version, ELPA (which is essentially the same).
This worked for me,
Get a Slime copy from https://github.com/slime/slime, either by git clone or by downloading the zip. Unzip and save it in D:/myuser/slime-2.13, for example
Download and install CLISP
Add this to the .emacs file, usually located in C:/users/myuser/AppData/Roaming:
; This is the path where you've saved Slime in the first step
(add-to-list 'load-path "D:/myuser/slime-2.13/")
(require 'slime-autoloads)
; This is the path where CLISP was installed.
; Use Progra~1 for "Program Files" and Progra~2 for "Program Files (x86)"
(setq inferior-lisp-program "/C/Progra~2/clisp-2.49/clisp.exe")
SLIME
I'm pretty new to both Clojure & emacs and I've been trying to set up SLIME for Clojure. The official documentation implicitly assumes you know what your doing with emacs. There isn't just a bunch of code you can stick into your configuration files. Since I am interested in Clojure for Data Analysis, I don't really want to deal with Leiningen if at all possible, but I want the dynamic environment that slime provides.
I have installed Clojure from git in /opt/clojure/ and clojure-contrib in /opt/clojure-contrib and I can get a repl. I installed swank-clojure, clojure-mode, and slime from github in `~/.bin following this tutorial. I changed a few things around when this wasn't working by adding some stuff from the comments section of the official documentation.
When I start slime with M-x slime I get a continuous Polling "/tmp/slime.14113".. (Abort with 'M-x slime-abort-connection'.).
Here is my init-clj.el:
;; clojure-mode
(add-to-list 'load-path "~/.bin/clojure-mode")
;; swank-clojure
(add-to-list 'load-path "~/.bin/swank-clojure")
(setq swank-clojure-jar-path "/opt/clojure/clojure.jar"
swank-clojure-extra-classpaths (list
"~/.bin/swank-clojure/src/swank"
"/opt/clojure/clojure-contrib/target/clojure-contrib-1.2.0-SNAPSHOT.jar"))
(require 'swank-clojure)
;; slime
(eval-after-load "slime"
'(progn (slime-setup '(slime-repl))))
(add-to-list 'load-path "~/.bin/slime")
(require 'slime)
(eval-after-load 'slime '(setq slime-protocol-version 'ignore))
(slime-setup '(slime-repl))
(require 'clojure-mode)
(require 'clojure-test-mode)
Here is the error I get when I call it when ants.clj is open:
(progn (load "/home/kca/.bin/slime/swank-loader.lisp" :verbose t) (funcall (read- from-string "swank-loader:init")) (funcall (read-from-string "swank:start-server") "/tmp/slime.14113" :coding-system "iso-latin-1-unix"))
Clojure 1.2.0-master-SNAPSHOT
user=> java.lang.Exception: Unable to resolve symbol: progn in this context (NO_SOURCE_FILE:1)
Inferior Lisp
I made a script in .bin/ called clj-repl that holds the java command to start a repl. I then M-x set-variable inferior-lisp-program /home/wdkrnls/.bin/clj-repl. Emacs complains its the wrong type.
The best way to use Clojure is to start by installing Leiningen.
Then install Swank Clojure as a Leiningen plugin.
Next, I'd recommend stripping your current custom Clojure setup from .emacs, and installing ELPA, and then setting up the following initialization code in your .emacs file:
;; Find this line, added by ELPA:
(require 'package)
;; and add the following expression:
(add-to-list 'package-archives
'("marmalade" .
"http://marmalade-repo.org/packages/") t)
;; ... and the rest of the ELPA init code
(package-initialize)
Then, run package-list-packages and install clojure-mode and slime (and paredit for good measure), and anything else you might want.
This should have you all set up and ready to use SLIME in (Leiningen) Clojure projects. And despite the seemingly complex procedure here, you can create a single "uberjar" from your projects to deploy on other servers with absolutely no dependency hassle.
Try the method detailed here. It takes a couple of minutes to set everything up from scratch on a clean unix or mac box:
http://www.learningclojure.com/2010/08/clojure-emacs-swank-slime-maven-maven.html
I can run emacs and start slime (with M-x slime). At this point I get the REPL in the inferior-lisp buffer and can run lisp there. But when I open up lisp code in another buffer none of the slime-goodness works (C-x C-e, C-c C-k etc.) and I keep seeing this in the Messages buffer (with an increasing count-number):
slime-connection: Not connected.
Polling
"/var/folders/B9/B9B5J15dH+aNt5J5gkROEk+++TI/-Tmp-/slime.3202".. (Abort with `M-x
slime-abort-connection'.) [69 times]
Makes me think slime is not connecting to the correct lisp interpreter, but since I am very new to emacs and lisp I am stuck here. My setup is:
Mac OSX Snow Leopard
GNU Emacs 23.2
emacs-starter-kit
very few customizations: arnab.el and the files under arnab/
The following is what I did to get Common Lisp and Clojure to work in the same Emacs installation, along with the excellent emacs-starter-kit. This won't let you use both at the same time (you have to restart Emacs to switch from CL to Clojure or vice versa)
I believe that the version of SLIME in ELPA is old, but works for Clojure. Newer version of SLIME won't work for Clojure. Additionally, this version of SLIME seems to be stripped down (no swank-loader.el?) and won't work with Common Lisp.
These are the steps I did to get this to work, it's just what worked for me. All of the bits are under active development, so I think breakage in this area is pretty likely.
With a fresh Emacs (no configuration at all, so move anything .emacs somewhere else for the moment) install ELPA:
http://tromey.com/elpa/install.html
From within Emacs, install the packages "slime" and "slime-repl". (M-x package-list-packages then C-s slime then i to select and x to install)
Move the files in ~/.emacs.d/elpa/slime-20100404 and ~/.emacs.d/elpa/slime-repl-20100404 to a new directory like ~/hacking/lisp/elpa-slime.
Throw out the ELPA install: $ rm -rf .emacs.d.
Now clone the emacs-starter-kit and move it to .emacs.d. I only did this with a fresh copy from technomancy's Github, so try that first if you have problems.
Get the latest SLIME with CVS:
cvs -d :pserver:anonymous:anonymous#common-lisp.net:/project/slime/cvsroot co cvs-slime
I don't think OS X comes with CVS installed, so you'll need to install it from Macports, Homebrew or something.
I put cvs-slime in ~/hacking/lisp.
Hopefully it's obvious what the Emacs Lisp below does:
(defun slime-common-lisp ()
(interactive)
(setq inferior-lisp-program "/usr/local/bin/sbcl") ; your Common Lisp impl
(add-to-list 'load-path "~/hacking/lisp/cvs-slime/") ; your SLIME from CVS directory
(require 'slime)
(slime-setup '(slime-repl))
(slime))
(defun slime-clojure ()
(interactive)
(add-to-list 'load-path "~/hacking/lisp/elpa-slime")
(require 'slime)
(slime-setup '(slime-repl))
(slime-connect "localhost" 4005))
For Clojure you'd have to start the Clojure runtime and swank-clojure on port 4005, I think using Leiningen is the approved method:
Create a new project:
$ lein new project
$ cd project
In project.clj:
(defproject newclj "1.0.0-SNAPSHOT"
:description "FIXME: write"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]]
:dev-dependencies [[swank-clojure "1.2.1"]])
Then:
$ lein deps
$ lein swank
Edited to add:
If you find that Paredit in the SLIME REPL is broken while using this setup, check this out:
http://www.emacswiki.org/emacs/ParEdit#toc3
At least one other potential issue with this is that, AFAICT, if you open a Common Lisp source file and then start SLIME, you won't be able to send forms from the first buffer to the SLIME buffer. So open a SLIME buffer before opening any Common Lisp source files, and it should work. This doesn't seem to apply to Clojure.
References:
emacs setup for both clojure and common lisp with slime-fancy (slime-autodoc)
https://github.com/technomancy/swank-clojure/issues/closed#issue/31/comment/544166
If u have correctly install slime in your system then better use sbcl and add the following line in your ~/.emacs
(setq inferior-lisp-program "/usr/bin/sbcl")
/usr/bin/sbcl can be different according to your sbcl installation path.