Skip to content
Browse files

Switch to clj-stacktrace-test hook and document :repl-options

  • Loading branch information...
1 parent df47e72 commit 3774f0fd212561aa152bfa6fc969a564c2f255d3 @technomancy technomancy committed Nov 30, 2010
Showing with 18 additions and 12 deletions.
  1. +12 −4 README.md
  2. +3 −1 project.clj
  3. +3 −7 src/leiningen/hooks/{clj_stacktrace.clj → clj_stacktrace_test.clj}
View
16 README.md
@@ -44,13 +44,21 @@ The library also offers an API for programatically 'parsing' exceptions. This AP
(catch Exception e
(parse-exception e)))
-If you use Leiningen, you can hook clj-stacktrace straight into your project. You'll need to add Robert Hooke to your :dependencies in project.clj. The {:color true} line is optional.
+If you use Leiningen, you can hook clj-stacktrace straight into your
+project in.
- :dependencies [[org.clojure/clojure "1.2.0"]
- [robert/hooke "1.1.0"]]
- :dev-dependencies [[clj-stacktrace "0.2.1-SNAPSHOT"]]
+ :dev-dependencies [[clj-stacktrace "0.2.1"]]
+ :hooks [leiningen.hooks.clj-stacktrace-test]
+ :repl-options [:caught clj-stacktrace.repl/pst+]
:clj-stacktrace {:color true}
+The :hooks entry will enable clj-stacktrace to be used by clojure.test
+and other things that use the clojure.stacktrace library. The
+:repl-options entry will cause clj-stacktrace to be used in the
+repl. Colorized stacktraces in clojure.test can interfere with some
+tools like Swank, so by default it uses pst rather than pst+; you can
+change this with {:color true}.
+
## License
Copyright 2009-2010 Mark McGranaghan and released under an MIT license.
View
4 project.clj
@@ -2,4 +2,6 @@
:description "More readable stacktraces in Clojure programs."
:url "http://github.com/mmcgrana/clj-stacktrace"
:dependencies [[org.clojure/clojure "1.2.0"]]
- :dev-dependencies [[lein-clojars "0.6.0"]])
+ :dev-dependencies [[lein-clojars "0.6.0"]]
+ :hooks [leiningen.hooks.clj-stacktrace-test]
+ :repl-options [:caught clj-stacktrace.repl/pst+])
View
10 src/leiningen/hooks/clj_stacktrace.clj → src/leiningen/hooks/clj_stacktrace_test.clj
@@ -6,17 +6,13 @@
(let [pst (if color?
'clj-stacktrace.repl/pst+
'clj-stacktrace.repl/pst)]
- `(do (if-let [add-hook# (resolve '~'robert.hooke/add-hook)]
- (add-hook# (resolve '~'clojure.stacktrace/print-cause-trace)
- (fn [original# & args#]
- (apply @(resolve '~pst) args#)))
- (println "clj-stacktrace needs robert.hooke dependency"))
+ `(do (alter-var-root (resolve '~'clojure.stacktrace/print-cause-trace)
+ (constantly @(resolve '~pst)))
~form)))
(defn- add-stacktrace-hook [eval-in-project project form & [h s init]]
(eval-in-project project (hook-form form (:color (:clj-stacktrace project)))
- h s `(do (try (require '~'robert.hooke)
- (require '~'clj-stacktrace.repl)
+ h s `(do (try (require '~'clj-stacktrace.repl)
(require '~'clojure.stacktrace)
(catch Exception _#))
~init)))

0 comments on commit 3774f0f

Please sign in to comment.
Something went wrong with that request. Please try again.