technomancy / swank-clojure

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

Autocomplete on "clojure." causes debugger to pop up [fix included] #104

Closed MHOOO closed 12 years ago

MHOOO commented 12 years ago

The debugger constantly pops up when I try to autocomplete a namespace using swank. I can easily fix this though by compiling the following (in any file):

;;; FIX FOR SWANK on clojure 1.3
(in-ns 'swank.commands.basic)
(defn- maybe-resolve-sym [symbol-name]
  (try
     (let [mns (maybe-ns *current-package*)
           sym (symbol symbol-name)]
      (ns-resolve mns sym))
    (catch ClassNotFoundException e nil)
    ;; for some reason we get back a RuntimeException...
    (catch RuntimeException e nil)))

This happens only when using clojure 1.3 - mainly because the ns-resolve call throws a RuntimeException with a cause, instead of directly a ClassNotFoundException. I'm using swank-clojure-1.4.0

tavisrudd commented 12 years ago

I'm curious what is the RuntimeException being thrown and which debugger is popping up (sldb or the emacs lisp debugger)? I'm not seeing this on 1.2 or 1.3.

MHOOO commented 12 years ago

SLDB is popping up with the following content:


clojure.set
  [Thrown class java.lang.ClassNotFoundException]

Restarts:
 0: [QUIT] Quit to the SLIME top level
 1: [ABORT] ABORT to SLIME level 2

Backtrace:
  0: URLClassLoader.java:202 java.net.URLClassLoader$1.run
  1: (Unknown Source) java.security.AccessController.doPrivileged
  2: URLClassLoader.java:190 java.net.URLClassLoader.findClass
  3: DynamicClassLoader.java:61 clojure.lang.DynamicClassLoader.findClass
  4: ClassLoader.java:306 java.lang.ClassLoader.loadClass
  5: ClassLoader.java:247 java.lang.ClassLoader.loadClass
  6: (Unknown Source) java.lang.Class.forName0
  7: Class.java:247 java.lang.Class.forName
  8:   RT.java:1997 clojure.lang.RT.classForName
  9: Compiler.java:6684 clojure.lang.Compiler.maybeResolveIn
 10:  core.clj:3859 clojure.core/ns-resolve
 11:  core.clj:3856 clojure.core/ns-resolve
 12:  basic.clj:196 swank.commands.basic/maybe-resolve-sym
 13:  basic.clj:239 swank.commands.basic/describe-symbol*
 14:  basic.clj:256 swank.commands.basic/eval1098[fn]
 15:   Var.java:401 clojure.lang.Var.invoke
 16: (Unknown Source) jMonkeyEngine.ai_monads$eval6442.invoke
 17: Compiler.java:6406 clojure.lang.Compiler.eval
 18: Compiler.java:6372 clojure.lang.Compiler.eval
 19:  core.clj:2745 clojure.core/eval
 20:   core.clj:100 swank.core/eval-in-emacs-package
 21:   core.clj:256 swank.core/eval-for-emacs
 22:   Var.java:409 clojure.lang.Var.invoke
 23:   AFn.java:167 clojure.lang.AFn.applyToHelper
 24:   Var.java:518 clojure.lang.Var.applyTo
 25:   core.clj:600 clojure.core/apply
 26:   core.clj:107 swank.core/eval-from-control
 27:   core.clj:218 swank.core/sldb-loop[fn]
 28:   core.clj:215 swank.core/sldb-loop
 29:   core.clj:231 swank.core/invoke-debugger
 30:   core.clj:235 swank.core/sldb-debug
 31:   core.clj:301 swank.core/eval-for-emacs
 32:   Var.java:409 clojure.lang.Var.invoke
 33:   AFn.java:167 clojure.lang.AFn.applyToHelper
 34:   Var.java:518 clojure.lang.Var.applyTo
 35:   core.clj:600 clojure.core/apply
 36:   core.clj:107 swank.core/eval-from-control
 37:   core.clj:218 swank.core/sldb-loop[fn]
 38:   core.clj:215 swank.core/sldb-loop
 39:   core.clj:231 swank.core/invoke-debugger
 40:   core.clj:235 swank.core/sldb-debug
 41:   core.clj:301 swank.core/eval-for-emacs
 42:   Var.java:409 clojure.lang.Var.invoke
 43:   AFn.java:167 clojure.lang.AFn.applyToHelper
 44:   Var.java:518 clojure.lang.Var.applyTo
 45:   core.clj:600 clojure.core/apply
 46:   core.clj:107 swank.core/eval-from-control
 47:   core.clj:218 swank.core/sldb-loop[fn]
 48:   core.clj:215 swank.core/sldb-loop
 49:   core.clj:231 swank.core/invoke-debugger
 --more--