Giter Site home page Giter Site logo

swank-clojure's Introduction

Swank Clojure

Swank Clojure is a server that allows SLIME (the Superior Lisp Interaction Mode for Emacs) to connect to Clojure projects.

Deprecated

This project is no longer under active development.

New users are strongly encouraged to try out nrepl.el instead. If you need an advanced debugger, Ritz might be a better fit.

Usage

The simplest way is to just "jack in" from an existing project using Leiningen:

  • Install clojure-mode either from Marmalade or from git.
  • Add [lein-swank "1.4.5"] to the :plugins section of either project.clj or your user profile.
  • From an Emacs buffer inside a project, invoke M-x clojure-jack-in

If you are still using a version of Leiningen older than 1.7.0, you will need to do lein plugin install swank-clojure 1.4.3 instead.

That's all it takes; there are no extra install steps beyond clojure-mode on the Emacs side and the swank-clojure plugin on the Leiningen side. In particular, be sure you don't have any other versions of SLIME loaded; see "Troubleshooting" below.

SLIME Commands

Commonly-used SLIME commands:

  • M-.: Jump to the definition of a var
  • M-TAB or C-c TAB: Autocomplete symbol at point
  • C-x C-e: Eval the form under the point
  • C-c C-k: Compile the current buffer
  • C-c C-l: Load current buffer and force required namespaces to reload
  • C-M-x: Compile the whole top-level form under the point.
  • C-c S-i: Inspect a value
  • 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 from a Clojure buffer to the repl buffer
  • C-c M-p: Switch the repl namespace to match the current buffer
  • C-c C-w c: List all callers of a given function

Pressing "v" on a stack trace a debug buffer will jump to the file and line referenced by that frame if possible.

Note that SLIME was designed to work with Common Lisp, which has a distinction between interpreted code and compiled code. Clojure has no such distinction, so the load-file functionality is overloaded to add :reload-all behaviour.

Alternate Usage

There are other ways to use Swank for different specific circumstances. For each of these methods you will have to install the slime and slime-repl Emacs Lisp libraries manually as outlined in "Connecting with SLIME" below.

Standalone Server

If you just want a standalone swank server with no third-party libraries, you can use the shell wrapper that Leiningen installs for you:

$ lein plugin install swank-clojure 1.4.3
$ ~/.lein/bin/swank-clojure

M-x slime-connect

If you put ~/.lein/bin on your $PATH it's even more convenient.

Manual Swank in Project

You can also start a swank server by hand from inside your project. You'll need to have installed using lein plugin install, then launch the server from the shell:

$ lein swank # you can specify PORT and HOST optionally

If you're using Maven, add this to your pom.xml under the <dependencies> section:

    <dependency>
      <groupId>swank-clojure</groupId>
      <artifactId>swank-clojure</artifactId>
      <version>1.4.3</version>
    </dependency>

Then you can launch a swank server like so:

$ mvn clojure:swank

Note that due to a bug in clojure-maven-plugin, you currently cannot include it as a test-scoped dependency; it must be compile-scoped. You also cannot change the port from Maven; it's hard-coded to 4005.

Embedding

You can embed Swank Clojure in your project, start the server from within your own code, and connect via Emacs to that instance:

(ns my-app
  (:require [swank.swank]))
(swank.swank/start-server) ;; optionally takes :host/:port keyword args

To make this work in production, swank-clojure needs to be in :dependencies in project.clj in addition to being installed as a user-level plugin. If you do this, you can also start the server directly from the java command-line launcher if you're using Clojure 1.3 or newer:

$ java -cp my-project-standalone-1.0.0.jar clojure.main -m swank.swank

Connecting with SLIME

If you're not using the M-x clojure-jack-in method mentioned above, you'll have to install SLIME yourself. The easiest way is to use package.el. If you are using Emacs 24 or the Emacs Starter Kit, then you have it already. If not, get it from Emacs's own repository.

Then add Marmalade as an archive source in your Emacs config:

(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "https://marmalade-repo.org/packages/") t)
(package-initialize)

Evaluate that, then run M-x package-refresh-contents to pull in the latest source lists. Then you can do M-x package-install and choose slime-repl.

When you perform the installation, you will see warnings related to the byte-compilation of the packages. This is normal; the packages will work just fine even if there are problems byte-compiling it upon installation.

Then you should be able to connect to the swank server you launched:

M-x slime-connect

It will prompt you for your host (usually localhost) and port. It may also warn you that your SLIME version doesn't match your Swank version; this should be OK.

To get syntax highlighting in your repl buffer, use this elisp:

(add-hook 'slime-repl-mode-hook
          (defun clojure-mode-slime-font-lock ()
            (require 'clojure-mode)
            (let (font-lock-mode)
              (clojure-mode-font-lock-setup))))

To get colors in stack traces, load the elisp in src/swank/payload/slime-frame-colors.el inside Emacs and use lein swank $PORT localhost :colors? true to launch the swank server.

Troubleshooting

Currently having multiple versions of swank-clojure on the classpath can cause issues when running lein swank or lein jack-in. It's recommended to not put swank-clojure in your :dev-dependencies but run lein plugin install to have it installed globally for all projects instead. This also means that people hacking on your project won't have to pull it in if they are not Emacs users.

It's also possible for some packages to pull in old versions of swank-clojure transitively, so check the lib/ directory if you are having issues. In particular, Incanter is known to exhibit this problem. Judicious use of :exclusions make it work:

   :dependencies [[incanter "1.2.3" :exclusions [swank-clojure]]]

Since swank-clojure 1.3.4, having versions of clj-stacktrace older than 0.2.1 in your project or user-level plugins will cause Unable to resolve symbol: pst-elem-str errors. Keep in mind that user-level plugins in ~/.lein/plugins are uberjars in Leiningen 1.x, so it's possible that one of your plugins (such as lein-difftest before version 1.3.7) contains an old clj-stacktrace even if it doesn't have its own file there. Specifying a newer version should be enough if you're having trouble:

    :dependencies [[clj-stacktrace "0.2.4"]]

Having old versions of SLIME installed either manually or using a system-wide package manager like apt-get may cause issues. Also the official CVS version of SLIME is not supported; it often breaks compatibility with Clojure. In addition, the slime-clj packages are incompatible with swank-clojure.

It's possible to have Emacs configured for both Common Lisp and Clojure if you defer loading of Slime until it's needed. This issue has details on how that is done. It's not possible to have a single instance of Emacs connect to both though.

Swank-clojure and SLIME are only tested with GNU Emacs; forks such as Aquamacs and XEmacs may work but are not officially supported.

On Mac OS X, Emacs sessions launched from the GUI don't always respect your configured $PATH. If Emacs can't find lein, you may need to give it some help. The quickest way is probably to add this elisp to your config:

(setenv "PATH" (shell-command-to-string "echo $PATH"))

When using clojure-jack-in, standard out for the Leiningen process appears in the *swank* buffer, but the *out* var gets rebound to a writer that is able to redirect to the *slime-repl* buffer. So in general most Clojure output will show up in your repl buffer just fine, but for output coming from Java libraries you may need to check the *swank* buffer.

Cygwin

If you are running Emacs from Cygwin, you'll need to add the following to your .emacs.d/init.el file:

(defun cyg-slime-to-lisp-translation (filename)
  (replace-regexp-in-string "\n" "" 
   (shell-command-to-string
     (format "cygpath.exe --windows %s" filename))))

(defun cyg-lisp-to-slime-translation (filename)
  (replace-regexp-in-string "\n" "" (shell-command-to-string
     (format "cygpath.exe --unix %s filename"))))

(setq slime-to-lisp-filename-function #'cyg-slime-to-lisp-translation)
(setq lisp-to-slime-filename-function #'cyg-lisp-to-slime-translation)

This is required because the jvm runs as a normal Windows exe and uses Windows style paths rather than Cygwin unix style paths.

How it Works

Swank Clojure is simply a server that communicates over the Slime protocol with an Emacs process. As such it runs in a JVM process, usually launched by Leiningen. Slime is a client that runs within Emacs to communicate with Swank. You can start the two of them separately as explained in "Connecting with SLIME" above, but M-x clojure-jack-in will send the elisp code for Slime to the Emacs process to ensure that it uses a version of Slime that is compatible with that version of Swank. Once the Swank server is finished loading, it sends a signal to Emacs to connect to it.

Debugger

You can set repl-aware breakpoints using swank.core/break. For now, see Hugo Duncan's blog for an explanation of this excellent feature.

CDT (included in Swank Clojure since 1.4.0) is a more comprehensive debugging tool that includes support for stepping, seting breakpoints, catching exceptions, and eval clojure expressions in the context of the current lexical scope.

Note that the CDT does not work with :eval-in-leiningen without extra manual configuration.

TODO

  • unmap-ns command
  • show method argument names in slime inspector (theoretically possible?)
  • show better metadata on functions in inspector
  • offer restarts for class/var not found exceptions (slamhound integration?)
  • add elisp payload for cdt commands
  • suppress false "warning: unabled to add tools.jar to classpath" message

Community

The swank-clojure mailing list and clojure channel on Freenode are the best places to bring up questions/issues.

Contributions are preferred as either Github pull requests or using "git format-patch". Please use standard indentation with no tabs, trailing whitespace, or lines longer than 80 columns. See this post on submitting good patches for some tips. If you've got some time on your hands, reading this style guide wouldn't hurt either.

License

Copyright © 2008-2012 Jeffrey Chu, Phil Hagelberg, Hugo Duncan, and contributors

Licensed under the EPL. (See the file COPYING.)

swank-clojure's People

Contributors

alexott avatar amalloy avatar blais avatar cosmin avatar derekmansen avatar dmansen avatar drewr avatar drone29a avatar fbreuer avatar hiredman avatar hugoduncan avatar jochu avatar juergenhoetzel avatar khinsen avatar kspi avatar marktriggs avatar njordhov avatar purcell avatar rottcodd avatar scgilardi avatar scottjad avatar swannodette avatar tavisrudd avatar tcrayford avatar technomancy avatar the-kenny avatar tobias avatar ubolonton avatar ucieee avatar ztellman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swank-clojure's Issues

slime-repl-set-package freezes clojure

I always thought namespaces should be changes automatically when switching buffers, or at least when compiling a file (with a (ns ...) form in it). But it doesn't. Also, using the slime-repl-set-package hangs my clojure session for good... I've asked (see http://stackoverflow.com/questions/3470999/how-do-i-connect-a-clojure-source-file-to-a-running-clojure-repl-on-emacs) if this was normal, and Isaac Hodes seems to share this behavior, so I've come up with this workaround http://gist.github.com/522706 . This is not optimal, by far, but it does help in the same way slime-repl-set-package was supposed to help :)

Do you know what's happening, or do you have any thoughts on this? Thanks in advance!

Connection closes after typing two characters.

I use swank-clojure 1.4.0-SNAPSHOT
After doing slime-connect and having the REPL, I typed "(+" and got disconnected from swank. Here's the output of lein swank:

$ lein swank
Connection opened on localhost port 4005.
unreadable message: (:emacs-rex (swank:autodoc (quote ("+" swank::%cursor-marker%)) :print-right-margin 155) "user" :repl-thread 4)
exception in read loop
java.lang.RuntimeException: java.lang.Exception: Invalid token: swank::
at clojure.lang.RT.readString(RT.java:1263)
at clojure.core$read_string.invoke(core.clj:2897)
at swank.core.protocol$read_swank_message$fn__272.invoke(protocol.clj:46)
at swank.core.protocol$read_swank_message.invoke(protocol.clj:45)
at swank.core.connection$read_from_connection.invoke(connection.clj:59)
at swank.core$read_loop.invoke(core.clj:348)
at swank.swank$connection_serve$fn__1740$fn__1741.invoke(swank.clj:33)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:540)
at swank.swank$connection_serve$fn__1740.doInvoke(swank.clj:30)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.Exception: Invalid token: swank::
at clojure.lang.LispReader.interpretToken(LispReader.java:286)
at clojure.lang.LispReader.read(LispReader.java:171)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1060)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
at clojure.lang.LispReader.read(LispReader.java:145)
at clojure.lang.RT.readString(RT.java:1260)
... 13 more
exception in control loop
java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2052)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:386)
at swank.util.concurrent.mbox$receive.invoke(mbox.clj:28)
at swank.core$control_loop.invoke(core.clj:401)
at swank.swank$connection_serve$fn__1706$fn__1707$fn__1708.invoke(swank.clj:23)
at swank.swank$connection_serve$fn__1706$fn__1707.invoke(swank.clj:22)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:540)
at swank.swank$connection_serve$fn__1706.doInvoke(swank.clj:20)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:636)

Swank fails to start because clojure.core/print-doc is not a known var

When I try to start swank in Emacs, I see the following error printed to the inferior-lisp buffer:

Clojure 1.3.0-master-SNAPSHOT
user=> CompilerException java.lang.Exception:
       Unable to resolve var: clojure.core/print-doc in this context, compiling:
       (swank/commands/basic.clj:210) 

In file basic.clj, I see the following code:

(def print-doc (if (-> #'clojure.core/print-doc meta :private)
                 print-doc*
                 clojure.core/print-doc))

The var print-doc is not available:

user=> clojure.core/print-doc
       CompilerException java.lang.Exception:
       No such var: clojure.core/print-doc, compiling:(NO_SOURCE_PATH:0) 

user=> #'clojure.core/print-doc
       CompilerException java.lang.Exception: Unable to resolve var:
       clojure.core/print-doc in this context, compiling:(NO_SOURCE_PATH:0) 

I see this code changed recently in commit 2b34883, so someone must have found it to be working against a freshly-built Clojure library.

Do I have something configured incorrectly?

Cygwin problems

When running under cygwin emacs there is a number of problemsrelated to the fact, that Java is not aware of cygwin paths. Some of these can be solved by replacing swank-clojure-binary with a custom clojure script, but than it fails when attempting to connect to the spawned process, since java cannot find a socket file.

Clojure 1.2.0-master-SNAPSHOT
user=> (require 'swank.swank)
nil
user=>
user=> (swank.swank/ignore-protocol-version nil)
nil
user=>
user=> (do (.. java.net.InetAddress getLocalHost getHostAddress) nil)(swank.swank/start-server "/cygdrive/c/DOCUME1/MADWOM1/LOCALS1/Temp/slime.5652" :encoding "iso-latin-1-unix")
nil
java.io.FileNotFoundException: \cygdrive\c\DOCUME
1\MADWOM1\LOCALS1\Temp\slime.5652 (The system cannot find the path specified) (NO_SOURCE_FILE:0)
user=>
user=>

Setting user.dir

Would be nice if swank-clojure-project would spawn java from the root of the given project. Currently user.dir is set to whatever directory the file you're currently editing is in.

SLIME doesn't work when fuzzy completion is enabled

If you setup fuzzy completion

(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol

SLIME freezes on slime-complete-symbol. If there is not intention to implement fuzzy-completion maybe it could at least be made an alias to simple-completion internally at this point.

specify java 6 requirement

setExecutable in File is new to Java 6. Plugin won't install with versions of Java < 6 as currently written.

slime trunk Oct 31 2009

Currently swank-clojure does not work with slime trunk as of October 31 2009. Please look into the following commit in slime that broke slime with swank-clojure.

commit: addc5 be70a489cdc8ed555a2fed7273040da196e
repository: git://git.boinkor.net/slime.git
I had to place a space in the above commit to prevent github from trying to be "smart" and assume the commit its own.

Alternatively see the commit here:
http://github.com/nablaone/slime/commit/22dba9f590a55977f41cb9a333012e9cb6619505

Maybe swank-clojure needs a corresponding swank-match.clj

slime stacktraces broken w/ clojure-1.3 snapshots with pst

When running swank-clojure with a clojure 1.3 snapshot that includes clojure.repl/pst, exception handling is broken.

Causing swank to evaluate a form that throws an exception does not bring up an sldb window with the stacktrace. slime-load-file (C-c C-l) and eval'ing forms in a slime repl demonstrate the behavior.

Swank fails to start because clj-contrib/pprint doesn't compile

When I attempt to start Swank (using the current tip version against the "master" branch), it fails with the following errors:

(require 'swank.swank)

(swank.swank/ignore-protocol-version "2011-03-13")

(do (.. java.net.InetAddress getLocalHost getHostAddress) nil)(swank.swank/start-server "/var/folders/GW/GW8s0M0DHCOwSFm5WtD8ok+++TI/-Tmp-/slime.244" :encoding "iso-latin-1-unix")

Clojure 1.3.0-master-SNAPSHOT
user=> CompilerException java.lang.ClassNotFoundException: swank/clj_contrib/pprint$fn__643$pretty_pr_code_STAR___644, compiling:(swank/clj_contrib/pprint.clj:34) 
user=> user=> CompilerException java.lang.Exception: No such var: swank.swank/ignore-protocol-version, compiling:(NO_SOURCE_PATH:3) 
user=> user=> nil
CompilerException java.lang.Exception: No such var: swank.swank/start-server, compiling:(NO_SOURCE_PATH:5) 

It looks like file pprint.clj is failing to compile due to the pretty-pr-code* macro not being defined as intended.

java.net.SocketException

running lein swank I get the following error:
java.net.SocketException: Invalid argument (NO_SOURCE_FILE:1)
which then prints the user=> prompt, then exits.

clojure-jack-in on Windows

I'm running Windows 7, Emacs 24. I installed swank-clojure per the new instructions, lein plugin install swank-clojure 1.4.0-SNAPSHOT. Within Emacs, I open eshell (per your video), navigate to a Clojure project, run lein deps and then try M-x clojure-jack-in.

Immediately after running that Emacs function, another buffer opens stating "The system cannot find the path specified". The minibuffer has "cd ~/my-clojure-project && lein jack-in 1187: exited abnormally with code 1.".

Seems like it's probably something simple. Any ideas?

clojure repl hangs after record or struct evalled with sequence param

First things first:
Mac OS X 10.6.7
Emacs: GNU Emacs 24.0.50.1 (i386-apple-darwin10.7.0, NS apple-appkit-1038.35) of 2011-06-02 on Rohan-Nichollss-MacBook-Pro.local
This was compiled on the system using homebrew.
I have just done a lein update
And this is the project file:
(defproject scrumptious "1.0.0-SNAPSHOT"
:description "FIXME: write"
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]
[ring/ring-core "0.3.5"]
[ring/ring-jetty-adapter "0.3.5"]
[clj-json "0.3.1"]
[ring-json-params "0.1.3"]
;; [ring "0.3.5"]
[clj-time "0.3.0-SNAPSHOT"]]
:dev-dependencies [[ring/ring-devel "0.3.5"]])
I installed swank-clojure as a lein plugin, and am using that.

Here is the start code, and I get the same result with a struct:

(defrecord link [id title url tags creation comments])
(defn nowint [](.getTime %28java.util.Date.%29))

If I create a link with atomic parameters it works
scrumptious.db> (link. 1 "Secure Google" "https://www.google.com" nil (nowint) nil)

:scrumptious.db.link{:id 1, :title "Secure Google", :url "https://www.google.com", :tags nil, :creation 1307603770553, :comments nil}

But if I now actually fill in the tags properly (note the vector where nil was in third to last param):
scrumptious.db> (link. 1 "Secure Google" "https://www.google.com" "search" "secure" "default" nil)

with swank-clojure 1.2.x it would just hang and I would have to disconnect and reconnect to get my repl back. In 1.3.1 it is more proactive, and disconnects on its own. A slime-connect reconnects, and the state is still there.

Ooh, in order to do this post I did a slime-connect to a lein swank (which is using the plugin) and I can see backtraces.

exception in read loop
java.lang.NumberFormatException: For input string: " ae"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at swank.core.protocol$read_swank_message.invoke(protocol.clj:41)
at swank.core.connection$read_from_connection.invoke(connection.clj:59)
at swank.core$read_loop.invoke(core.clj:337)
at swank.swank$connection_serve$fn__1580$fn__1581.invoke(swank.clj:41)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:540)
at swank.swank$connection_serve$fn__1580.doInvoke(swank.clj:38)
at clojure.lang.RestFn.invoke(RestFn.java:398)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:637)

I am not sure if this helps.

Thanks for any help on this, I think it might be related to the windows issues I have seen, but perhaps this is more specific. ;)

Rohan

"Error in process filter: Wrong number of arguments: nil, 0" Error

Whenever I run swank-clojure through lein on any of my computers, I get an error message when an exception occurs that says "Error in process filter: Wrong number of arguments: nil, 0". In order to reproduce, I just need to do:

lein swank
M-x slime-connect
At this point I get a "Versions differ 2010-10-19 (slime) vs. 20100404 (swank)" warning.
Enter y to Continue anyway
Enter any expression that causes an exception such as (+ "foo" "bar")
The error message is generated

I imagine this is probably tied to the version number warning, but I don't really know what to do about that.

A unicode character which blows up the Slime connection

Hi,

I use swank-clojure 1.4.0-SNAPSHOT. At the moment I'm using Clojure to fetch some emails from a Google Mail account via the JavaMail API. In one of the standard Google welcome emails is a unicode character which blows up my Slime connection, for example when I use the function slurp to get the text data from an InputStream of a javax.mail.BodyPart. However this also happens if I read the character from a text file. The Unicode character is: C2AA
Nevertheless I would like to mention that I have also experienced a similar error last week, while I were fetching JSON data from the Google Calendar API. It would be great if this error would be fixed, at the moment I have to write the corresponding result into a file each and every time, if I like to look at its content.

Best regards

Max

The error log:

Debugger entered--Lisp error: (end-of-file)
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# #("000025(:write-string "\"ª\"\n" :repl-result)000016(:return (:ok nil) 13)" 0 72 (charset iso-8859-1)))
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# #("000025(:write-string "\"ª\"\n" :repl-result)000015(:return (:ok nil) 6)" 0 71 (charset iso-8859-1)))
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# #("000025(:write-string "\"�\"\n" :repl-result)000015(:return (:ok nil) 8)" 0 72 (charset iso-8859-1)))
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# "000023(:write-string "nil\n" :repl-result)000016(:return (:ok nil) 18)")
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# "000016(:return (:ok nil) 17)")
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# #("000334(:write-string "\"You can import your contacts and mail from Yahoo!, Hotmail, AOL, and many\r\nother web mail or POP accounts. If you want, we'll even keep importing your\r\nmail for the next 30 days.\r\n Import contacts and mail\r\n�https://mail.google.com/mail/#settings/accounts\\r\\n\\r\\nWe know it can be a pain to switch email accounts, and we hope this makes\r\nthe transition to Google Mail a bit easier.\r\n\r\n- The Google Mail Team\r\n\r\nPlease note that importing is not available if you're using Internet\r\nExplorer 6.0. To take advantage of the latest Google Mail features,\r\nplease upgrade\r\nto a fully supported\r\nbrowserhttp://mail.google.com/support/bin/answer.py?answer=6557&hl=en&utm_source=wel-eml&utm_medium=eml&utm_campaign=en\r\n.\r\n\"\n" :repl-result)" 0 828 (charset iso-8859-1)))
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# #("0001e5(:write-string "\" [image: Access Google Mail on your mobile phone]\r\nhttp://www.google.com/intl/en/mobile/default/mail.html\r\n\r\nThe days of needing your computer to get to your inbox are long gone. You\r\ncan now use Google Mail on your mobile phone to access your email from\r\nanywhere.\r\n Get Google Mail for your phone\r\n»http://www.google.com/intl/en/mobile/default/mail.html#utm_source=wel-eml&utm_medium=eml&utm_campaign=en\\r\\n\\"\n\" :repl-result)000016(:return (:ok nil) 73)" 0 520 (charset iso-8859-1)))
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# #("0001e5(:write-string "\" [image: Access Google Mail on your mobile phone]\r\nhttp://www.google.com/intl/en/mobile/default/mail.html\r\n\r\nThe days of needing your computer to get to your inbox are long gone. You\r\ncan now use Google Mail on your mobile phone to access your email from\r\nanywhere.\r\n Get Google Mail for your phone\r\n»http://www.google.com/intl/en/mobile/default/mail.html#utm_source=wel-eml&utm_medium=eml&utm_campaign=en\\r\\n\\"\n\" :repl-result)000016(:return (:ok nil) 84)" 0 520 (charset iso-8859-1)))
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# "000052(:write-string "#<core$future_call$reify__5500@2b5d70ae: :pending>\n" :repl-result)000017(:return (:ok nil) 128)")
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# "000017(:return (:ok nil) 127)")
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# "000023(:write-string "nil\n" :repl-result)")
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# "000052(:write-string "#<core$future_call$reify__5500@343abc87: :pending>\n" :repl-result)000017(:return (:ok nil) 126)")
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# "00002f(:write-string "#'postal.pop3/m\n" :repl-result)000017(:return (:ok nil) 125)")
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# #("0001e5(:write-string "\" [image: Access Google Mail on your mobile phone]\r\nhttp://www.google.com/intl/en/mobile/default/mail.html\r\n\r\nThe days of needing your computer to get to your inbox are long gone. You\r\ncan now use Google Mail on your mobile phone to access your email from\r\nanywhere.\r\n Get Google Mail for your phone\r\n»http://www.google.com/intl/en/mobile/default/mail.html#utm_source=wel-eml&utm_medium=eml&utm_campaign=en\\r\\n\\"\n\" :repl-result)000017(:return (:ok nil) 124)" 0 521 (charset iso-8859-1)))
recursive-edit()
byte-code("\306� @\307=\203!�\310\311\312"\210\313\311!\211�A@)\242\314=\203!�\310\315\312"\210\316�!\210\317 \210\320 !\210\f\203d�\321ed"
V\203W�eb\210\322
\245y\210��db\210\322 \245 Zy\210��|\210)\323c\210eb\210\324\325\326 "\210\327\306!\210\324\330!\210\331\312����\324\330!\210\212\332 \210+\331\207" [unread-command-char debugger-args x debugger-buffer noninteractive debugger-batch-max-lines -1 debug backtrace-debug 4 t backtrace-frame lambda 5 pop-to-buffer debugger-mode debugger-setup-buffer count-lines 2 "...\n" message "%s" buffer-string kill-emacs "" nil recursive-edit middlestart buffer-read-only standard-output] 4)
debug(error (end-of-file))
byte-code("\302\300�"\210\303 \304"\210\300\305�"\207" [error process debug slime-net-close t "net-read error: %S"] 3)
slime-net-read-or-lose(#)
slime-process-available-input(#)
slime-net-filter(# #("0001e5(:write-string "\" [image: Access Google Mail on your mobile phone]\r\nhttp://www.google.com/intl/en/mobile/default/mail.html\r\n\r\nThe days of needing your computer to get to your inbox are long gone. You\r\ncan now use Google Mail on your mobile phone to access your email from\r\nanywhere.\r\n Get Google Mail for your phone\r\n»http://www.google.com/intl/en/mobile/default/mail.html#utm_source=wel-eml&utm_medium=eml&utm_campaign=en\\r\\n\\"\n\" :repl-result)000017(:return (:ok nil) 123)" 0 521 (charset iso-8859-1)))

[request] swank-clojure-create-project?

With the existence of swank-clojure-project, would it make sense to have a create project as well that would spin up the directory structure with all the necessary includes to start and build a Clojure project?

Lose clojure.core/doc in 1.3.0 alpha >= 4

When using clojure 1.3.0alpha n, where n >= 4 I cannot use (doc foo) at the repl in slime. At the main repl (mvn clojure:repl) it is present. Where n<4 it functions correctly.

The error is:

Unable to resolve symbol: doc in this context
[Thrown class java.lang.Exception]

Unable to start 'lein swank' on a project called swank

I am unable to start a swank server with the latest clojure 1.3 snapshots, here is my project.clj:

(defproject swank "1.0.0"
  :description "Random project for connecting to swank"
  :dependencies [[org.clojure/clojure "1.3.0-master-SNAPSHOT"]
                 [org.clojure.contrib/complete "1.3.0-SNAPSHOT" :classifier "bin"]]
  :dev-dependencies [[swank-clojure "1.3.0-SNAPSHOT"]])

Here's the stack trace for starting swank: http://gist.github.com/588399

IllegalArgumentException thrown at REPL

I get this exception thrown at the Swank REPL... But not when running the same code at the commandline:

No matching method found: println for class swank.util.io.proxy$java.io.StringWriter$0
[Thrown class java.lang.IllegalArgumentException]

Restarts:
0: [ABORT] Return to SLIME's top level.

Backtrace:
0: clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:50)
1: clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
2: clojure.contrib.sql.internal$print_update_counts__7348.invoke(internal.clj:132)
3: clojure.contrib.sql.internal$transaction_STAR___7362.invoke(internal.clj:162)
4: clojure.contrib.sql$do_commands__7390.doInvoke(sql.clj:89)
5: clojure.lang.RestFn.invoke(RestFn.java:413)
6: clojure.contrib.sql$create_table__7430.doInvoke(sql.clj:119)
7: clojure.lang.RestFn.invoke(RestFn.java:428)
8: myproject.record$create_schema_version_table__3688.invoke(NO_SOURCE_FILE:1)
9: myproject.record$migrate__3465$fn__3469.invoke(NO_SOURCE_FILE:1)
10: clojure.contrib.sql.internal$with_connection_STAR___7339.invoke(internal.clj:105)
11: myproject.record$migrate__3465.invoke(NO_SOURCE_FILE:1)
12: myproject.record$migrate__3465.invoke(NO_SOURCE_FILE:1)
13: myproject.record$eval__3735.invoke(NO_SOURCE_FILE:1)
14: clojure.lang.Compiler.eval(Compiler.java:4642)
15: clojure.core$eval__5236.invoke(core.clj:2017)
16: swank.commands.basic$eval_region__912.invoke(basic.clj:40)
17: swank.commands.basic$eval_region__912.invoke(basic.clj:31)
18: swank.commands.basic$eval__932$listener_eval__934.invoke(basic.clj:54)
19: clojure.lang.Var.invoke(Var.java:359)
20: myproject.record$eval__3732.invoke(NO_SOURCE_FILE)
21: clojure.lang.Compiler.eval(Compiler.java:4642)
22: clojure.core$eval__5236.invoke(core.clj:2017)
23: swank.core$eval_in_emacs_package__460.invoke(core.clj:59)
24: swank.core$eval_for_emacs__538.invoke(core.clj:128)
25: clojure.lang.Var.invoke(Var.java:367)
26: clojure.lang.AFn.applyToHelper(AFn.java:179)
27: clojure.lang.Var.applyTo(Var.java:476)
28: clojure.core$apply__4370.invoke(core.clj:436)
29: swank.core$eval_from_control__463.invoke(core.clj:66)
30: swank.core$eval_loop__466.invoke(core.clj:71)
31: swank.core$spawn_repl_thread__600$fn__632$fn__634.invoke(core.clj:183)
32: clojure.lang.AFn.applyToHelper(AFn.java:171)
33: clojure.lang.AFn.applyTo(AFn.java:164)
34: clojure.core$apply__4370.invoke(core.clj:436)
35: swank.core$spawn_repl_thread__600$fn__632.doInvoke(core.clj:180)
36: clojure.lang.RestFn.invoke(RestFn.java:402)
37: clojure.lang.AFn.run(AFn.java:37)
38: java.lang.Thread.run(Thread.java:637)

clojure-jack-out

Enhancement request: a way to reverse the effects of clojure-jack-in.

If I need to restart the repl (eg: because I add or change a dependency), it's not obvious how to do it. At the moment I'm doing something with ps + grep clojure + kill, which is awkward.

There may already be a way to do this, but I don't see it documented.

Thanks.

extend-protocol issue

extend-protocol rewrites (not appends) :impl. I.e. I do extend-protocol calls for protocol P with methods A B C for defining methods A B, then call extend-protocol got defining method C. Result: only C method in :impl

Clojure and Common Lisp Compatibility on Mac Os X

Requirements

While searching for a satisfactory solution to a compatible Clojure / CL emacs configuration, I started to understand my requirements better. The fundamental requirement was that the emacs configuration must allow for unobtrusive use of Clojure, Common Lisp, Quicklisp, Slime and SBCL.

As a secondary requirement, the solution could not involve manual maintenance and conflict management of multiple copies of slime.

If you're programming in Common Lisp, then you probably know why Quicklisp is a requirement. It's the package manager that CL brings parity with the best of the younger programming languages. If you're working on Clojure, you probably want leiningen for similar reasons.

Solution

Most of the solutions I've seen put the user through contortions or, when I've tried them, don't work (at least not on Mac Os X with Quicklisp as part of the equation).

The solution I am experimenting with at the moment is surprisingly simple. This approach gave me inspiration but fails on the count of requiring too much manual slime configuration management. It did helped me to realize though that I could defer loading slime and only run slime setup on demand, i.e. on M-x slime. That way, if instead, I want to run clojure, I can M-x clojure-jack-in without the presence of a potentially conflicting slime setup in my emacs image. This is an excerpt from my .emacs file. Most of this is just standard Quicklisp slime initialization.

;;; Define a slime that defers slime setup. It first detaches itself
;;; then runs slime setup, then invokes the "real" slime.
;;; By delaying slime setup, quicklisp slime setup doesn't interfere
;;; with M-x clojure-jack-in.
;;;
(defun slime ()
(interactive)
(fmakunbound 'slime)
(load (expand-file-name "~/quicklisp/slime-helper.el"))
(set-language-environment "UTF-8")
(setq slime-net-coding-system 'utf-8-unix)
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(slime))

With this minor modification, M-x slime behaves as before and continues to use the Quicklisp maintained copy of Slime. If I am working in Clojure, M-x clojure-jack-in works as expected. This is working for me with Aquamacs and GNU Emacs for Mac OS X (24).

Setup is based on Emacs for Mac Os X (23.3.1), Quicklisp Slime current (08/11), Swank-clojure 1.3.2 and Snow Leopard. The initial Clojure-swank setup came from the technomancy's readme on the swank-clojure github site.

Problems Along the Way

  1. Multiple versions of swank-clojure in my classpath; removed older plugins with lein plugin uninstall.
  2. Emacs couldn't find my Brew installed line in the path; adding this to .emacs was sufficient: (setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))
  3. Aquamacs had an old version of Slime installed in its private elpa location ( /Users/john/Library/Application Support/Aquamacs Emacs/elpa), a leftover from a previous Clojure integration effort . Removing the older versions of slime from the Aquamacs location allowed me to use the Quicklisp version of slime, same as GNU Emacs for Mac Os X.

unnecessary thread creation?

It appears that every time I evaluate a form in emacs at least one new thread is created on the JVM. Is this strictly necessary? Would it be possible to use a thread pool?

clojure-jack-in evaluates output from ~/.lein/init.clj

If you have an init.clj file in ~/.lein, and that file prints out any text, the clojure-jack-in procedure will attempt to evaluate it as elisp at the beginning of the swank buffer.

To reproduce:

  • create an iniit.clj file in ~/.lein and have it execute (println "Loaded init.clj")
  • open emacs and type M-x clojure-jack-in
  • emacs will eventually report "Error: Symbol's value as a var is void: Loaded"
  • open the swank buffer and note the text "Loaded init.clj" at the top of the buffer.

debug-repl not really working?

The referenced debug-repl that docs indicate is in swank-clojure 1.2.1 doesn't seem to work for me. Eg:

Am I overlooking something?
EDIT: fixed to read 1.2.1

slime-compile and interface generation

Consider this file:

(ns foo)

(defprotocol Foo
  (foo [this x]))

(defn make-foo-proxy []
  (proxy [foo.Foo] []
    (foo [x] (prn x))))

(foo (make-foo-proxy) 42)
;EDIT: fixed typo in last line

After compiling once with C-c C-k, everything works fine. However, compiling a second time yields:

No implementation of method: :foo of protocol: #'foo/Foo found for class: foo.proxy$java.lang.Object$Foo$d757b77e

Interestingly, typing (compile 'foo) in the repl fixes this for the whole session, even if I change the protocol.

Issue with both 'clojure-jack-in' and 'lein swank'

Hello, I previously had swank-clojure working, but since having tried the 'clojure-jack-in' method, I found that it emacs (23.3.1) stated it was starting the swank-server, but would just sit there indefinetely.

Having tried this, when I attempted to go back to using 'lein swank', after I tell emacs to 'slime-connect' I get a usual "repl connected" type message, but none of my buffers switch to a repl, nor are there any selectable buffers that contain a repl.

Perhaps something is wrong with my emacs, but I have tried this with a relatively minimal .emacs setup, just in case.

Any help is appreciated, thank you!

jack in not connecting

Same symptoms as #53 but I don't have any extra versions in the plugins directory or the projects file.

This is the output in the swank buffer after running jack in:

;;; Bootstrapping bundled version of SLIME; please wait...


(when (not (featurep 'slime-c3230b2c))
               (if (file-readable-p "/home/wdouglas/.emacs.d/swank/slime-c3230b2c.elc")
                 (load-file "/home/wdouglas/.emacs.d/swank/slime-c3230b2c.elc")
               (byte-compile-file "/home/wdouglas/.emacs.d/swank/slime-c3230b2c.el" t)))
(when (not (featurep 'slime-repl-79b38c83))
               (if (file-readable-p "/home/wdouglas/.emacs.d/swank/slime-repl-79b38c83.elc")
                 (load-file "/home/wdouglas/.emacs.d/swank/slime-repl-79b38c83.elc")
               (byte-compile-file "/home/wdouglas/.emacs.d/swank/slime-repl-79b38c83.el" t)))
(sleep-for 0.1)

(run-hooks 'slime-load-hook) ; on port 62733

And if I use slime-connect at this point on the local port I can get a repl.

SLIME doesn't work when autodoc is enabled

When slime-autodoc-mode is enabled I always get this exception:

[bozhidar@bozhidar-desktop ~/Projects]$ ~/.lein/bin/swank-clojure
user=> Connection opened on local port 4005

<ServerSocket ServerSocket[addr=localhost/127.0.0.1,port=0,localport=4005]>

unreadable message: (:emacs-rex (swank:autodoc (quote ("printl" swank::%cursor-marker%)) :print-right-margin 164) "user" :repl-thread 5)

exception in read loop
java.lang.RuntimeException: java.lang.Exception: Invalid token: swank::
at clojure.lang.RT.readString(RT.java:1263)
at clojure.core$read_string.invoke(core.clj:2897)
at swank.core.protocol$read_swank_message$fn__240.invoke(protocol.clj:44)
at swank.core.protocol$read_swank_message.invoke(protocol.clj:43)
at swank.core.connection$read_from_connection.invoke(connection.clj:59)
at swank.core$read_loop.invoke(core.clj:337)
at swank.swank$connection_serve$fn__1485$fn__1486.invoke(swank.clj:41)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:540)
at swank.swank$connection_serve$fn__1485.doInvoke(swank.clj:38)
at clojure.lang.RestFn.invoke(RestFn.java:398)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.Exception: Invalid token: swank::
at clojure.lang.LispReader.interpretToken(LispReader.java:286)
at clojure.lang.LispReader.read(LispReader.java:171)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1060)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
at clojure.lang.LispReader.read(LispReader.java:145)
at clojure.lang.RT.readString(RT.java:1260)
... 13 more

I guess nobody is willing to implement proper autodoc support for Clojure, but it would be nice if at least it didn't produce an error. People doing both CL and Clojure development have to constantly keep switching on and off this setting because of the issue.

Weird versions when installing plugin swank-clojure vs. running it.

If I do plugin install swank-clojure (like the readme suggests), it installs clojure 1.2. If I then run lein swank, it downloads clojure 1.2.1. Weirdness.

~/src/clojure-setup $ lein plugin install swank-clojure 1.3.0

Installing shell wrapper to /home/justinlilly/.lein/bin/swank-clojure
Downloading: org/clojure/clojure/1.2.0/clojure-1.2.0.pom from central
Downloading: org/clojure/clojure/1.2.0/clojure-1.2.0.jar from central
Copying 1 file to /tmp/lein-6aa5c79e-b1ca-4b38-a86c-dded8d93dc56/lib
Downloading: lein-multi/lein-multi/1.0.0/lein-multi-1.0.0.pom from central
Downloading: lein-multi/lein-multi/1.0.0/lein-multi-1.0.0.pom from clojure
Downloading: lein-multi/lein-multi/1.0.0/lein-multi-1.0.0.pom from clojars
Transferring 2K from clojars
Downloading: lein-multi/lein-multi/1.0.0/lein-multi-1.0.0.jar from central
Downloading: lein-multi/lein-multi/1.0.0/lein-multi-1.0.0.jar from clojure
Downloading: lein-multi/lein-multi/1.0.0/lein-multi-1.0.0.jar from clojars
Transferring 3K from clojars
Copying 1 file to /tmp/lein-6aa5c79e-b1ca-4b38-a86c-dded8d93dc56/lib/dev
Including swank-clojure-1.3.0.jar
Including clojure-1.2.0.jar
Created swank-clojure-1.3.0.jar
~/src/clojure-setup $ ~/.lein/bin/swank-clojure 
user=> Connection opened on local port  4005
#<ServerSocket ServerSocket[addr=localhost/127.0.0.1,port=0,localport=4005]>
interrupt
~/src/clojure-setup $ lein swank
Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.pom from central
Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.jar from central
Copying 1 file to /home/justinlilly/src/clojure-setup/lib
user=> Connection opened on local port  4005
#<ServerSocket ServerSocket[addr=localhost/127.0.0.1,port=0,localport=4005]>

Shell script but no batch file

lein install swank-clojure 1.3.0-SNAPSHOT

and we get ~/.lein/bin/swank-clojure, a shell script...on Windows?? Maybe you could include a batch file instead. Here's one I created.

(slime-inferior-process) returns nil if using `M-x slime-connect`

The problem is that (at least) slime-redirect-inferior-output is throwing an error if there's no inferior process, and that happens only if I start slime via slime-connect (i.e., a M-x swank-clojure-project sets up the inferior-process properly). I know these functions aren't in swank-clojure (slime.el and slime-repl.el), but I suspect this behavior should be connected to it - feel free to redirect me to other discussion places! :)

one workaround could be to detect clojure's particular case, with an advice, maybe, and silent that error (since it doesn't seem to affect me on other lisps, iirc). but we'd still loose everything that depends on a slime-inferior-process... ideas?

[Severe] Windows: Swank freezes on any GUI-related user input.

On my system (Windows XP SP3, 32 Bit, JRE 1.6.0_18, JDK 1.6.0_12) this can be reproduced as follows:

  1. Install Clojure Box 1.1.0 (January 5, 2010)

  2. Start the Slime REPL and enter this line:
    (. javax.swing.JOptionPane (showMessageDialog nil "snafu"))

    Result: The Slime REPL stalls and doesn't return a result.

  3. Visit the inferior-lisp REPL buffer and place your cursor at the
    command line. Press 'return'.

    Result: The Slime thread continues and displays the messagebox.
    The Slime REPL returns.

Other failing examples:
(clojure.contrib.javadoc.browse/browse-url "http://clojure.org")

    ; Incanter
    (require '(incanter charts))

When the above lines are entered directly into the inferior-lisp
buffer they get executed promptly and without errors.

There are two related threads (1, 2) on the mailing list.

I haven't noticed any such problems on my Mac and Linux boxes.
On Windows, I keep some Elisp around to swiftly revive a stuck Slime
session:

    (defun slime-poke-clojure ()
     (interactive)
     (slime-send-to-process "\n"))

    (defun slime-send-to-process (command)
     (interactive)
     (let ((slime (slime-inferior-process)))
       (if slime (comint-redirect-send-command-to-process
                  command (process-buffer slime) slime nil t)
         (message "No Slime process running."))))

clojure 1.1.0-master-SNAPSHOT dependency missing

I noticed recently that swank-clojure 1.1.0 (which some projects, including lein-search, have as a dev-dependency) is now missing its clojure 1.1.0-master-SNAPSHOT dependency, which breaks lein deps for all clients of that version of swank-clojure.

Any chance of updating that version to use clojure 1.1.0 instead?

Not sure why those SNAPSHOTs got deleted; Chas thinks it's normal Maven practice, though: http://groups.google.com/group/clojure-dev/browse_thread/thread/149bc60e05cfaa2e

  • Colin

clojure-jack-in fails on Mac OS X/emacs24 with stack trace

Trying to run clojure-jack-in fails with the following error when run on Mac OS X with emacs24 nightly build (http://emacsformacosx.com/emacs-builds/Emacs-2011-10-09-universal-10.6.7.dmg) from http://emacsformacosx.com/builds

Have clojure-mode installed as well as swank-clojure 1.3.3

See below:

➜  .lein  tree
.
├── bin
│   └── swank-clojure
├── plugins
│   └── swank-clojure-1.3.3.jar
└── self-installs
    └── leiningen-1.6.1.1-standalone.jar

3 directories, 3 files
Debugger entered--Lisp error: (error "Could not start swank server: ;;; Bootstrapping bundled version of SLIME; please wait...


(when (not (featurep 'slime-cdf283b4))
               (if (file-readable-p \"/Users/ptc/.emacs.d/swank/slime-cdf283b4.elc\")
                 (load-file \"/Users/ptc/.emacs.d/swank/slime-cdf283b4.elc\")
               (byte-compile-file \"/Users/ptc/.emacs.d/swank/slime-cdf283b4.el\" t)))
(when (not (featurep 'slime-repl-79b38c83))
               (if (file-readable-p \"/Users/ptc/.emacs.d/swank/slime-repl-79b38c83.elc\")
                 (load-file \"/Users/ptc/.emacs.d/swank/slime-repl-79b38c83.elc\")
               (byte-compile-file \"/Users/ptc/.emacs.d/swank/slime-repl-79b38c83.el\" t)))
(sleep-for 0.1)
(run-hooks 'slime-load-hook) ; on port 62210
Exception in thread \"main\" java.lang.RuntimeException: java.lang.NoSuchMethodError: clojure.lang.RestFn.(I)V
    at clojure.lang.Util.runtimeException(Util.java:165)
    at clojure.lang.Compiler.eval(Compiler.java:6476)
    at clojure.lang.Compiler.load(Compiler.java:6902)
    at clojure.lang.RT.loadResourceScript(RT.java:357)
    at clojure.lang.RT.loadResourceScript(RT.java:348)
    at clojure.lang.RT.load(RT.java:427)
    at clojure.lang.RT.load(RT.java:398)
    at clojure.core$load$fn__4610.invoke(core.clj:5386)
    at clojure.core$load.doInvoke(core.clj:5385)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5200)
    at clojure.core$load_lib.doInvoke(core.clj:5237)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_libs.doInvoke(core.clj:5275)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:604)
    at clojure.core$use.doInvoke(core.clj:5363)
    at clojure.lang.RestFn.invoke(RestFn.java:457)
    at swank.commands.basic$eval645$loading__4505__auto____646.invoke(basic.clj:1)
    at swank.commands.basic$eval645.invoke(basic.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6465)
    at clojure.lang.Compiler.eval(Compiler.java:6455)
    at clojure.lang.Compiler.load(Compiler.java:6902)
    at clojure.lang.RT.loadResourceScript(RT.java:357)
    at clojure.lang.RT.loadResourceScript(RT.java:348)
    at clojure.lang.RT.load(RT.java:427)
    at clojure.lang.RT.load(RT.java:398)
    at clojure.core$load$fn__4610.invoke(core.clj:5386)
    at clojure.core$load.doInvoke(core.clj:5385)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5200)
    at clojure.core$load_lib.doInvoke(core.clj:5237)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_libs.doInvoke(core.clj:5271)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:604)
    at clojure.core$use.doInvoke(core.clj:5363)
    at clojure.lang.RestFn.invoke(RestFn.java:512)
    at swank.swank$eval40$loading__4505__auto____41.invoke(swank.clj:1)
    at swank.swank$eval40.invoke(swank.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6465)
    at clojure.lang.Compiler.eval(Compiler.java:6455)
    at clojure.lang.Compiler.load(Compiler.java:6902)
    at clojure.lang.RT.loadResourceScript(RT.java:357)
    at clojure.lang.RT.loadResourceScript(RT.java:348)
    at clojure.lang.RT.load(RT.java:427)
    at clojure.lang.RT.load(RT.java:398)
    at clojure.core$load$fn__4610.invoke(core.clj:5386)
    at clojure.core$load.doInvoke(core.clj:5385)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5200)
    at clojure.core$load_lib.doInvoke(core.clj:5237)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_libs.doInvoke(core.clj:5271)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$require.doInvoke(core.clj:5352)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at user$eval27.invoke(NO_SOURCE_FILE:1)
    at clojure.lang.Compiler.eval(Compiler.java:6465)
    at clojure.lang.Compiler.eval(Compiler.java:6455)
    at clojure.lang.Compiler.eval(Compiler.java:6431)
    at clojure.core$eval.invoke(core.clj:2795)
    at clojure.main$eval_opt.invoke(main.clj:296)
    at clojure.main$initialize.invoke(main.clj:315)
    at clojure.main$null_opt.invoke(main.clj:348)
    at clojure.main$main.doInvoke(main.clj:426)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:405)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.Var.applyTo(Var.java:518)
    at clojure.main.main(main.java:37)
Caused by: java.lang.NoSuchMethodError: clojure.lang.RestFn.(I)V
    at clojure.contrib.def$defmacro___509.(def.clj:39)
    at clojure.contrib.def__init.load(Unknown Source)
    at clojure.contrib.def__init.(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at clojure.lang.RT.loadClassForName(RT.java:2030)
    at clojure.lang.RT.load(RT.java:417)
    at clojure.lang.RT.load(RT.java:398)
    at clojure.core$load$fn__4610.invoke(core.clj:5386)
    at clojure.core$load.doInvoke(core.clj:5385)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5200)
    at clojure.core$load_lib.doInvoke(core.clj:5237)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_libs.doInvoke(core.clj:5271)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:604)
    at clojure.core$use.doInvoke(core.clj:5363)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.contrib.macro_utils$loading__6309__auto____4173.invoke(macro_utils.clj:14)
    at clojure.contrib.macro_utils__init.load(Unknown Source)
    at clojure.contrib.macro_utils__init.(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at clojure.lang.RT.loadClassForName(RT.java:2030)
    at clojure.lang.RT.load(RT.java:417)
    at clojure.lang.RT.load(RT.java:398)
    at clojure.core$load$fn__4610.invoke(core.clj:5386)
    at clojure.core$load.doInvoke(core.clj:5385)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5200)
    at clojure.core$load_lib.doInvoke(core.clj:5237)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$load_libs.doInvoke(core.clj:5271)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:602)
    at clojure.core$require.doInvoke(core.clj:5352)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at swank.clj_contrib.macroexpand$eval695.invoke(macroexpand.clj:9)
    at clojure.lang.Compiler.eval(Compiler.java:6465)
    ... 73 more
")

Make swank-clojure part of slime project as contrib

Making swank-clojure a slime contrib will make it easier to keep swank-clojure and slime in sync.
Right now being forced to use older version of slime and ELPA in order to use clojure is a pain, especially for regular Common Lisp users that already have perfectly working slime setup which should be shared for clojure too.

slime-load-file :reload-all is inconvenient

The recent commit, 115ace4 that adds :reload-all to slime is very inconvenient for a project using defrecords. The :reload-all usually reloads a file containing a defrecord, breaking all 'instance? checks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.