Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 4 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 72 additions and 38 deletions.
  1. +66 −36 README.md
  2. +6 −2 src/emacs/swank-clojure.el
View
102 README.md
@@ -4,37 +4,57 @@
adapter that lets you use SLIME (the Superior Lisp Interaction Mode
for Emacs) with Clojure.
-## Installation
+## Usage
-1. Install from ELPA using package.el[1].
+Depending on what you're using it for, Swank Clojure can be invoked in
+a few different ways:
-2. Press M-x slime to start a new Clojure process. Press "y" when
- asked if you want to install Clojure.
+1. Standalone Session: If you just hit M-x slime, swank-clojure will
+ download the jars for Clojure 1.0, contrib, and swank-clojure,
+ launch an instance, and connect to it. If you just want to try out
+ Clojure, this is all you need. Just get Swank Clojure through
+ [ELPA](http://tromey.com/elpa) and stop reading here. =)
+
+2. Custom classpath: If you want to hack on Clojure or Contrib, set
+ swank-clojure-classpath to a list of paths to the jars you want to
+ use and then hit M-x slime.
+
+3. Project: Put your project's dependencies in the lib/ directory,
+ (either manually or using
+ [leiningen](http://github.com/technomancy/leiningen) or Maven) then
+ launch M-x swank-clojure-project. Note that you must have
+ swank-clojure.jar in the lib/ directory, it will not automatically
+ add itself to the classpath as it did in past versions that had to
+ run from a checkout.
+
+4. Standalone Server: Users of leiningen or clojure-maven-plugin can
+ [launch a server from a
+ shell](http://wiki.github.com/technomancy/leiningen/emacs-integration)
+ and connect to it from within Emacs using M-x slime-connect.
+
+Because the JVM classpath can't be modified at runtime, you can't
+start a session with plain M-x slime and then decide to work on your
+project; you'll need to start a new slime session with M-x
+swank-clojure-project.
-3. Do you seriously need a third step? OK, if you want to use a newer
- version of Clojure than 1.0 you will need to build it yourself and
- symlink the compiled jar to ~/.swank-clojure/clojure-$VERSION.jar
- after removing the old version.
-
-If swank-clojure-classpath is not set within Emacs, it will assume
-that you want swank-clojure to handle it for you and will download and
-configure the necessary jars itself. If you already have a checkout of
-Clojure and/or Contrib that you would like to use, just set
-swank-clojure-classpath to a list that includes both those jars as
-well as swank-clojure.jar. If you already have a project with all its
-dependencies set up, see M-x swank-clojure-project documented below.
+## Installation
-(See also Installing from Source below if you want to use the
-absolute latest version of swank-clojure.)
+Install [from ELPA](http://tromey.com/elpa) using package.el[1].
-## Project
+If you're only going to use #4 above, you'll only need the
+"slime-repl" package. Otherwise get the "swank-clojure" package.
-You can also start a Slime session for a given project:
+While it's possible to install swank-clojure manually, it's not
+recommended. ELPA will be included in the next version of Emacs and
+has been a standard piece of the Emacs ecosystem for a while
+now. See the "Installing from Source" section below if you wish to
+hack on a development version that hasn't been released yet.
- M-x swank-clojure-project
+## Project Layout
-This will prompt for a project dir and set up the classpath for that
-structure based on some existing Clojure conventions:
+If you intend to use M-x swank-clojure-project, it will prompt for a
+project dir and set up the classpath for that structure based on some
+existing Clojure conventions:
* src/, classes/, and test/ - added to the classpath
* lib/ - all .jars in here are added to the classpath
@@ -45,11 +65,13 @@ structure based on some existing Clojure conventions:
Your project should include *all* its dependent jars (including
Clojure and Swank-Clojure) in either lib/ or target/dependency. If it
depends on more than just Clojure, Contrib, and Swank, it's
-recommended that you use a dependency manager such as maven to place
-these.
+recommended that you use a dependency manager such as Leiningen to
+manage these.
-If you add jars to lib/ and want to use them, simply invoke M-x
-swank-clojure-project again to restart with them on the classpath.
+If you have a running session and you add jars to lib/, you need to
+start a new session. Invoke M-x swank-clojure-project to get a session
+with the new classpath in place. M-x slime-restart-inferior-lisp will
+restart the subprocess, but it does not recalculate the classpath.
## Embedding
@@ -65,9 +87,9 @@ Then use M-x slime-connect to connect from within Emacs.
You can also start the server directly from the "java" command-line
launcher if you use "swank.swank" as your main class.
-## Usage
+## Commands
-Common commands:
+Commonly-used commands:
* **M-TAB**: Autocomplete symbol at point
* **C-x C-e**: Eval the form under the point
@@ -77,6 +99,7 @@ Common commands:
* **C-c C-m**: Macroexpand the call under the point
* **C-c C-d C-d**: Look up documentation for a var
* **C-c C-z**: Switch to the repl buffer
+* **C-c M-p**: Switch the repl namespace to match the current buffer
## Keeping Common Lisp
@@ -90,18 +113,21 @@ Then launch Slime with M-- M-x slime $LISP instead of just M-x slime.
## Community
The [mailing list](http://groups.google.com/group/swank-clojure) and
-#clojure on Freenode are the best places to bring up questions/issues.
-Contributions are preferred as either Github pull requests or using
-"git format-patch".
+clojure channel on Freenode are the best places to bring up
+questions/issues.
-Please use standard Emacs indentation with no tabs.
+Contributions are preferred as either Github pull requests or using
+"git format-patch" as is requested [for contributing to Clojure
+itself](http://clojure.org/patches). Please use standard indentation
+with no tabs, trailing whitespace, or lines longer than 80 columns. If
+you've got some time on your hands, reading this [style
+guide](http://mumble.net/~campbell/scheme/style.txt) wouldn't hurt
+either.
## Installing from Source
Swank-clojure is really two pieces: a server written in Clojure and a
-launcher written in Elisp. Using the latest version of the Elisp
-should pull in the latest version of the Clojure code as well, but
-you'll need to manually install the elisp dependencies as well.
+launcher written in Elisp. The elisp parts are installed with:
$ git clone git://github.com/technomancy/slime.git
$ git clone git://github.com/technomancy/clojure-mode.el
@@ -112,6 +138,10 @@ M-x package-install-from-buffer in each buffer in order. You will get
compiler warnings, but they should not be fatal. Restart Emacs, and
you should be able to use M-x slime.
+The Clojure-side server is managed with
+[Leiningen](http://github.com/technomancy/leiningen). Use the "lein
+install" task to place it in your local repository.
+
## License
Copyright (C) 2008-2009 Jeffrey Chu, Phil Hagelberg
View
8 src/emacs/swank-clojure.el
@@ -6,7 +6,7 @@
;; Phil Hagelberg <technomancy@gmail.com>
;;
;; URL: http://github.com/technomancy/swank-clojure
-;; Version: 1.0
+;; Version: 1.0.1
;; Keywords: languages, lisp
;; Package-Requires: ((slime-repl "20091016") (clojure-mode "1.6"))
;;
@@ -124,6 +124,7 @@ For example -Xmx512m or -Dsun.java2d.noddraw=true"
(re-search-forward regexp nil t))
(match-string-no-properties 3)))))
+;;;###autoload
(defun swank-clojure-slime-mode-hook ()
(slime-mode 1)
(set (make-local-variable 'slime-find-buffer-package-function)
@@ -150,7 +151,10 @@ will be used over paths too.)"
(write-file (concat swank-clojure-jar-home "/" jar-name))
(kill-buffer))
(error
- (delete-directory swank-clojure-jar-home t)
+ ;; no recursive directory deletion on emacs 22 =(
+ (dolist (j (directory-files swank-clojure-jar-home t))
+ (delete-file j))
+ (delete-directory swank-clojure-jar-home)
(error "Failed to download Clojure jars."))))))
(defun swank-clojure-check-install ()

No commit comments for this range

Something went wrong with that request. Please try again.