Browse files

Use context classloader to get completions

Fall back gracefully if that fails too.

closes #108
  • Loading branch information...
1 parent 50f1d4b commit b1251eb632a087eeae2ceec6f82bf96a770f8e39 @trptcolin committed Apr 7, 2013
Showing with 9 additions and 2 deletions.
  1. +1 −0 CHANGELOG.md
  2. +8 −2 src/clj/reply/initialization.clj
View
1 CHANGELOG.md
@@ -7,6 +7,7 @@
- Eliminate defn override / `sourcery` (#102)
- Fix negative rationals (cgrand/sjacket#14)
- Allow input of non-BMP characters (jline/jline2#80)
+- Handle completion load failure more gracefully (#108)
## 0.1.10, 2012-02-15
- Handle interruption (via ctrl-c) during input with new jline capabilities
View
10 src/clj/reply/initialization.clj
@@ -183,8 +183,14 @@
(catch Exception e#
(try
- (eval '~(formify-file
- (ClassLoader/getSystemResource "complete/core.clj")))
+ (eval
+ '~(try
+ (formify-file
+ (-> (Thread/currentThread)
+ (.getContextClassLoader)
+ (.getResource "complete/core.clj")))
+ (catch Exception e
+ '(throw (Exception. "Couldn't find complete/core.clj")))))
(catch Exception f#
(intern (create-ns '~'complete.core) '~'completions
(fn [prefix# ns#] []))

0 comments on commit b1251eb

Please sign in to comment.