How to install the slime into emacs under Windows7 - emacs

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")

Related

SLIME not loading from Emacs

I've recently updated SLIME from package-list-packages in Emacs. However, when I try to run it using M-x slime, I get this:
(progn (load "/home/koz/.emacs.d/elpa/slime-20140913.730/swank-loader.lisp" :verbose t) (funcall (read-from-string "swank-loader:init")) (funcall (read-from-string "swank:start-server") "/tmp/slime.3081"))
*
; loading #P"/home/koz/.emacs.d/elpa/slime-20140913.730/swank-loader.lisp"
;;
;; Error while compiling /home/koz/.emacs.d/elpa/slime-20140913.730/swank/backend.lisp:
;; Failed to find the TRUENAME of /home/koz/.emacs.d/elpa/slime-20140913.730/swank/backend.lisp:
;; No such file or directory
;; Aborting.
;; *
I still have a REPL afterwards, but I think this is very strange, and I'd like to know what's going on and why.
On Freenode's #lisp channel, I talked to one person who agreed that the current version of SLIME in MELPA (20140913.730) is broken. On my system, the whole $HOME/.emacs.d/elpa/slime-20140913.730/swank/ directory is missing, which presumably is why it can't compile Lisp files found therein.
Other members of the channel suggested installing SLIME from Quicklisp; I did that and it worked, although the SLIME version there is slightly older (dated 2014-08-01). Here is what I did (I didn't already have Quicklisp installed); adjust to match your system and preferences:
Uninstall SLIME from Emacs's package list (do M-x list-packages, go to the line for SLIME, press d, then press x).
Visit http://www.quicklisp.org/beta/ and download the file in the green box (in my case, it went in ~/Downloads).
Upgrade SBCL to 1.2.2 or later. This is probably overkill.
Launch sbcl.
Evaluate (load "~/Downloads/quicklisp.lisp").
Evaluate (quicklisp-quickstart:install); optionally, if you don't want it to go in ~/quicklisp, add :path "~/.quicklisp/" (substituting whatever directory you actually do want it installed in).
Install SLIME and SWANK by evaluating (ql:quickload "swank").
Optional: evaluate (ql:add-to-init-file) to patch your .sbclrc to always load Quicklisp in SBCL.
Exit SBCL with Ctrl+D.
Adjust your Emacs config file as shown in SLIME's readme. For the path entry, use "~/quicklisp/dists/quicklisp/software/slime-2.9" (adjusted for whatever path you installed Quicklisp in).
Restart Emacs and M-x slime should work.
This is caused by losing the swank sub-directory in your slime folder. To fix it, you can simple download slime from github and copy the folder swank to your slime installed path, for your situation is /home/koz/.emacs.d/elpa/slime-20140913.730/ then restart your slime. it will be load correctly.

Loading packages installed through 'package.el' in Emacs24 [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Emacs 24 Package System Initialization Problems
I am using Emacs 24. I have the ELPA and Marmalade repos added. Using 'package' I installed 'auto-complete'. I have the following lines added to my init.el:
(require 'auto-complete-config)
(ac-config-default)
When I start Emacs, I get the error
File error: Cannot open load file, auto-complete-config
But then I use
M-x load-file
and load the same ~/.emacs.d/init.el file, it then works fine with the prompt saying
Loading /home/user/.emacs.d/init.el (source)...done
How is the usual loading different from the 'M-x load-file' command? In the start of the init.el file I do the following, is this somehow effecting the package from loading.
(add-to-list 'load-path "~/.emacs.d")
(load "custom_code")
As mentioned in the comment below: The answer by phils to the duplicate question is probably more helpful than this one
This almost certainly means that your init.el file is getting run before the code that sorts out the packages for package.el. The latter code adds the directory with the auto-complete library to your load path.
I'm still using ELPA, rather than package.el. With elpa, there's a snippet that looks like this that gets installed at the bottom of your .emacs.
;;; This was installed by package-install.el.
;;; This provides support for the package system and
;;; interfacing with ELPA, the package archive.
;;; Move this code earlier if you want to reference
;;; packages in your .emacs.
(when
(load
(expand-file-name "~/.emacs.d/elpa/package.el"))
(package-initialize))
As the comment suggests, you probably want to put your equivalent package.el initialization code before the stuff that loads init.el.
Finally: I notice you mention adding .emacs.d to your load-path. The Emacs load path is not recursive, so that probably won't do what you need (assuming that your libraries live in subdirectories). Years ago, I wrote this snippet to load up various libraries of elisp code that I'd written. You might find it useful. (Obviously, it'll only work on unixy systems with a shell and a find command. It's reasonably slow, but this seems to be shell-command-to-string, which takes several milliseconds even running "echo hello" or the like)
(defun find-elisp-dirs (dir)
"Find all directories below DIR containing elisp sources, ignoring those"
(split-string
(shell-command-to-string
(format "find %s -iname '*.el' -printf '%%h\\n' | sort -u"
(expand-file-name dir t)))))

What is wrong with my emacs/slime setup (compile-and-load/eval not working)?

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.

Emacs (Cocoa Emacs) vs Aquamacs for running Clojure on Mac OS X

I used Aquamacs so far, and I need to install and run Clojure using SLIME. I googled to get some way to use Clojure on SLIME of Aquamacs, but without success.
Questions
Is it possible to install Clojure on Aquamacs? Or, can you guess why Clojure on Aquamacs doesn't work?
Is it normal that Emacs and Aquamacs can't share the same ELPA?
Is it possible to use ELPA to install Conjure on Emacs/Aquamacs?
I was told that one can use 'lein swank' to run as a server, do you know how to do that?
Sequences that I tried (and half succeeded)
I tried with Mac OS X Emacs, and by following the steps I could make it work. I mean, I could run Clojure with SLIME.
Emacs for Mac OS X
Step 1) Install ESK.
Git clone and copy all the files into the .emacs.d directory
Add the following code to .emacs and relaunch
(when
(load
(expand-file-name "~/.emacs.d/package.el"))
(package-initialize))
Step2) Install using ELPA
M-x package-list-packages to select packages
Install
clojure-mode, clojure-test-mode
slime, slime-repl
swank-clojure
M-x slime to install the clojure
Add the following code to .emacs and relaunch
;; clojure mode
(add-to-list 'load-path "/Users/smcho/.emacs.d/elpa/clojure-mode-1.7.1")
(require 'clojure-mode-autoloads)
(add-to-list 'load-path "/Users/smcho/.emacs.d/elpa/clojure-test-mode-1.4")
(require 'clojure-test-mode-autoloads)
;; slime
;(setq inferior-lisp-program "/Users/smcho/bin/clojure")
(add-to-list 'load-path "/Users/smcho/.emacs.d/elpa/slime-20100404")
(require 'slime-autoloads)
(add-to-list 'load-path "/Users/smcho/.emacs.d/elpa/slime-repl-20100404")
(require 'slime-repl-autoloads)
;; swank-clojure
(add-to-list 'load-path "/Users/smcho/.emacs.d/elpa/swank-clojure-1.1.0")
(require 'slime-repl-autoloads)
Aquamacs
Now I could use Clojure on Emacs, I tried the same(or very similar) method to run Clojure on Aquamacs once more.
Step 1) Install ESK for Aquamacs
Copy the files to ~/Library/Preference/Aquamacs Emacs
Modify "~/Library/Preferences/Aquamacs Emacs/Preferences.el" to add the following
(setq kitfiles-dir (concat (file-name-directory
(or (buffer-file-name) load-file-name)) "/aquamacs-emacs-starter-kit"))
; set up our various directories to load
(add-to-list 'load-path kitfiles-dir)
(require 'init)
Step2)
* Follow the same step as before to install all the (same) packages, but "M-x slime" gives me the following error message. "Symbol's function definition is void: define-slime-contrib"
ELPA
I tried to combine the packages from Emacs and Aquamacs, but they don't combine. I thought I could use the ELPA itself, not from the ESK to make it shared.
The result was not good, as ELPA couldn't download the swank-conjure package.
Success - Running Aquamacs/Clojure with 'lein swank'.
Please refer to this.
Aquamacs most definitely works with Clojure, since the author of Clojure uses it. However, I use Emacs, and after you perform the steps above in the Emacs section, I recommend checking out labrepl,
http://github.com/relevance/labrepl
If you don't have leiningen, the link to get and install it is in the instructions of the labrepl readme file. I found it extremely helpful when first learning how to set up an environment for Clojure programming. You can take apart the project.clj file in labrepl and piece together how it works pretty easily. Not to mention the lessons and training in the built in web application that comes with labrepl.
If you want to use lein swank instead:
Make sure you have leiningen installed. In your project.clj dev dependencies you want to have an entry like this:
[leiningen/lein-swank "1.1.0"]
http://clojars.org/leiningen/lein-swank
Then after you've done lein deps you should be able to run lein swank and then from within Emacs run M-x slime-connect and just press enter through the defaults.
If you're going to go this route, here is the link directly to leiningen so you can skip the labrepl repository: http://github.com/technomancy/leiningen
I found this the easiest setup for the latest version of everything. Here's a quick summary where I"m assuming you have leiningen installed.
Install the swank-clojure plugin
$ lein plugin install swank-clojure 1.3.2
Create your clojure project
$ lein new test-project
$ cd test-project
$ lein deps
Then open one of the clojure files from your project in emacs and run clojure-jack-in
M-x clojure-jack-in
You are now in a slime buffer with clojure and the dependencies for your project loaded.
Paul Barry gives an lecture how to use Aquamacs and Clojure.
It's simple as you can add this code to the .emacs file,
(add-to-list 'load-path "~/clojure/clojure-mode")
(setq inferior-lisp-program "/Users/smcho/bin/clj")
(require 'clojure-mode)
(setq auto-mode-alist
(cons '("\\.clj\\'" . clojure-mode)
auto-mode-alist))
(add-hook 'clojure-mode-hook
(lambda ()
(define-key clojure-mode-map "\C-c\C-e" 'lisp-eval-last-sexp)))
I could run 'M-x clojure-mode', and C-c C-z for REPL.
And as is asked and answered in Running Clojure and other Lisp at the same time on Emacs, I could use both Clojure/Lisp on Aquamacs.

How do I set up Aquamacs for Clojure development?

I've tried to migrate to Emacs several times for Clojure development, following a variety of blogposts, screencast and tutorials, but somewhere along the way something always went wrong - keybindings that didn't work, incompatible versions, etc, and I found myself scrambling back to Vim. But I know I want Paredit and SLIME.
So, I'm going to try again, this time backed by the powerful Stack Overflow™ community.
I hope that the answer to this question will remain up-to-date, and can serve as a reference for tentative converts like me.
What I'd like is:
The latest stable release of Clojure
Aquamacs (if it's good enough for Rich Hickey, it's good enough for me), a recent version
Clojure Mode
SLIME/SWANK
Paredit
Anything else that's indispensible?
Step-by-step instructions to install the above would be excellent - preferably in shell script format. I'd also like some hints on how to get started with the most common Clojure-related actions (including key-bindings), including links to documentation and cheatsheets.
These are the steps I took to set them up without using ELPA. Hope this helps.
Get SLIME using MacPorts
sudo port -v install slime
Get paredit
curl -O http://mumble.net/~campbell/emacs/paredit.el
Get clojure & clojure-contrib
Either using MacPorts
sudo port -v install clojure clojure-contrib
Or downloading directly
curl -O http://build.clojure.org/snapshots/org/clojure/clojure/1.1.0-master-SNAPSHOT/clojure-1.1.0-master-20091202.150145-1.jar
curl -O http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.1.0-master-SNAPSHOT/clojure-contrib-1.1.0-master-20091212.205045-1.jar
Get clojure-mode and swank-clojure (Emacs side)
git clone http://github.com/technomancy/clojure-mode.git
git clone http://github.com/technomancy/swank-clojure.git
Get swank-clojure (Clojure side)
Either downloading pre-built jar file
curl -O http://repo.technomancy.us/swank-clojure-1.1.0.jar
Or building from source (assuming lein is installed)
cd path/to/dir/swank-clojure
lein jar
Put clojure, clojure-contrib and swank-clojure .jar files in ~/.swank-clojure or ~/.clojure (the default places where swank-clojure.el searches for them).
Add to either ~/.emacs or ~/Library/Preferences/Aquamacs Emacs/customization.el (change paths to match your own settings)
(add-to-list 'load-path "/opt/local/share/emacs/site-lisp/slime/")
(add-to-list 'load-path "/opt/local/share/emacs/site-lisp/slime/contrib/")
;; Change these paths to match your settings
(add-to-list 'load-path "path/to/dir/clojure-mode/")
(add-to-list 'load-path "path/to/dir/swank-clojure/")
(add-to-list 'load-path "path/to/dir/paredit/")
;; Customize swank-clojure start-up to reflect possible classpath changes
;; M-x ielm `slime-lisp-implementations RET or see `swank-clojure.el' for more info
(defadvice slime-read-interactive-args (before add-clojure)
(require 'assoc)
(aput 'slime-lisp-implementations 'clojure
(list (swank-clojure-cmd) :init 'swank-clojure-init)))
(require 'slime)
(require 'paredit)
(require 'clojure-mode)
(require 'swank-clojure)
(eval-after-load "slime"
'(progn
;; "Extra" features (contrib)
(slime-setup
'(slime-repl slime-banner slime-highlight-edits slime-fuzzy))
(setq
;; Use UTF-8 coding
slime-net-coding-system 'utf-8-unix
;; Use fuzzy completion (M-Tab)
slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
;; Use parentheses editting mode paredit
(defun paredit-mode-enable () (paredit-mode 1))
(add-hook 'slime-mode-hook 'paredit-mode-enable)
(add-hook 'slime-repl-mode-hook 'paredit-mode-enable)))
;; By default inputs and results have the same color
;; Customize result color to differentiate them
;; Look for `defface' in `slime-repl.el' if you want to further customize
(custom-set-faces
'(slime-repl-result-face ((t (:foreground "LightGreen")))))
(eval-after-load "swank-clojure"
'(progn
;; Make REPL more friendly to Clojure (ELPA does not include this?)
;; The function is defined in swank-clojure.el but not used?!?
(add-hook 'slime-repl-mode-hook
'swank-clojure-slime-repl-modify-syntax t)
;; Add classpath for Incanter (just an example)
;; The preferred way to set classpath is to use swank-clojure-project
(add-to-list 'swank-clojure-classpath
"path/to/incanter/modules/incanter-app/target/*")))
Download and install Aquamacs.
Download and install ELPA (http://tromey.com/elpa/install.html)
Do M-x package-list-packages
Mark the lines called "clojure-mode" and "swank-clojure" with "I" then press "X".
Done.
Here's a blog post that mentions Aquamacs: Setting up Clojure, Incanter, Emacs, Slime, Swank, and Paredit
There seems to be a fairly easy way to set up Aquamacs 2.4 and SLIME for clojure:
Install Clojure
Install Aquamacs 2.4 from here "http://aquamacs.org/"
Install the Aquamacs SLIME package from here "http://aquamacs.org/download.shtml"
This will not work so...
Get the latest version of SLIME from here "http://common-lisp.net/project/slime/#downloading" - you want the CVS snapshot tar file
Unpack the SLIME tar file and copy it into
/Library/Application Support/Aquamacs Emacs/SLIME
Seems to work OK for me...
I know the OP wants to use Emacs for Clojure dev. I'm an emacs fan myself, but I found using Enclojure (http://www.enclojure.org/home) to be a great way to get started quickly with hacking Clojure.
Today I would head for https://github.com/tehcurtis/aquamacs-emacs-starter-kit/network
this is for ruby and wont work at first but anyway. git clone and copy things to Preferences.el according to readme. Fix the brokenness by edit the ~/Library/Preferences/Aquamacs Emacs/ and comment out almost everything in modes.el (I have only (setq-default indent-tabs-mode nil) left in the file)
The good part: you have installed elpa-package-manager with less hassle
now: use
M-x package-list-packages
go to
clojure-mode (press I)
slime (press I)
slime-repl (press I)
Press X to install
done.
Caveat: clojure-jack-in wont work so you have to
M-x slime-connect
and press enter twice and y to start.