technomancy / swank-clojure

Swank/slime support for clojure
Eclipse Public License 1.0
412 stars 83 forks source link

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

Closed seh closed 13 years ago

seh commented 13 years ago

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 2b348835d2a22d61de19cf3aa28c121ff23fc5a8, so someone must have found it to be working against a freshly-built Clojure library.

Do I have something configured incorrectly?

scottjad commented 13 years ago

I'm not really sure but here are two things to consider:

If you're "start[ing] swank in Emacs", you should try running lein swank.

My Clojure 1.2.0 has clojure.core/print-doc, maybe you're running an old clojure?

scottjad commented 13 years ago

opps, clicked "comment and close" and not sure how to reopen

seh commented 13 years ago

I'm running with a freshly-built Clojure 1.3.0 snapshot, from the tip of the "master" branch. I don't use Leiningen, and it should not be necessary to start Swank. It never was before.

I scanned the Clojure source, and the definition of print-doc is in src/clj/clojure/repl.clj, and that definition is private by virtue of defn-.

technomancy commented 13 years ago

I have pushed a fix that moves the print-doc lookup to runtime; should work in 1.3 now.

seh commented 13 years ago

I verified that the fix works with Clojure 1.3. Thank you for following through so quickly.