Meikel  Brandmeyer avatar Meikel Brandmeyer committed 99b6b6e

Move to clojure 1.2

Comments (0)

Files changed (5)

     }
 
     dependencies {
-        development 'org.clojure:clojure:1.1.0'
+        development 'org.clojure:clojure:1.2.0'
     }
 
     uploadArchives {

server/src/main/clojure/vimclojure/optional/clj_stacktrace.clj

 
 (clojure.core/in-ns 'vimclojure.util)
 
-(require '[clj-stacktrace.repl :as stacktrace])
+(require '[clj-stacktrace.repl :as clj-st])
 
 (defoptional pretty-print-stacktrace
   [e]
-  (stacktrace/pst e))
+  (clj-st/pst e))
 
 (defoptional pretty-print-causetrace
   [e]
-  (stacktrace/pst e))
-
-(def stacktrace-printer :clj-stacktrace)
+  (clj-st/pst e))

server/src/main/clojure/vimclojure/optional/core_stacktrace.clj

-;-
-; Copyright 2010 (c) Meikel Brandmeyer.
-; All rights reserved.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a copy
-; of this software and associated documentation files (the "Software"), to deal
-; in the Software without restriction, including without limitation the rights
-; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-; copies of the Software, and to permit persons to whom the Software is
-; furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included in
-; all copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-; THE SOFTWARE.
-
-(clojure.core/in-ns 'vimclojure.util)
-
-(require '[clojure.stacktrace :as stacktrace])
-
-(defoptional pretty-print-stacktrace
-  [e]
-  (stacktrace/print-stack-trace e))
-
-(defoptional pretty-print-causetrace
-  [e]
-  (stacktrace/print-cause-trace e))
-
-(def stacktrace-printer :clojure.stacktrace)

server/src/main/clojure/vimclojure/optional/prettyprint.clj

-;-
-; Copyright 2009 (c) Meikel Brandmeyer.
-; All rights reserved.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a copy
-; of this software and associated documentation files (the "Software"), to deal
-; in the Software without restriction, including without limitation the rights
-; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-; copies of the Software, and to permit persons to whom the Software is
-; furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included in
-; all copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-; THE SOFTWARE.
-
-(clojure.core/in-ns 'vimclojure.util)
-
-(require '[clojure.contrib.pprint :as pprint])
-
-(defoptional pretty-print
-  [form]
-  (pprint/pprint form))
-
-(defoptional pretty-print-code
-  [form]
-  (pprint/with-pprint-dispatch pprint/*code-dispatch*
-    (pprint/pprint form)))

server/src/main/clojure/vimclojure/util.clj

 ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 ; THE SOFTWARE.
 
-(ns vimclojure.util)
+(ns vimclojure.util
+  (:require
+    [clojure.pprint :as pprint]
+    [clojure.stacktrace :as stacktrace]))
 
 ; Common helpers
 (defn str-cut
   "Print the given form in a pretty way. If Tom Faulhaber's pretty printer is
   not installed simply defaults prn."
   [form]
-  (prn form))
+  (pprint/pprint form))
 
 (defn pretty-print-code
   "Print the given form in a pretty way. If Tom Faulhaber's pretty printer is
   not installed simply defaults prn. Uses the *code-dispatch* formatting."
   [form]
-  (prn form))
+  (pprint/with-pprint-dispatch pprint/code-dispatch
+    (pprint/pprint form)))
 
 (defn pretty-print-stacktrace
   "Print the stacktrace of the given Throwable. Tries clj-stacktrace,
   clojure.stacktrace and clojure.contrib.stacktrace in that order. Otherwise
   defaults to simple printing."
   [e]
-  (.printStackTrace e *out*))
+  (stacktrace/print-stack-trace e))
 
 (defn pretty-print-causetrace
   "Print the causetrace of the given Throwable. Tries clj-stacktrace,
   clojure.stacktrace and clojure.contrib.stacktrace in that order. Otherwise
   defaults to simple printing."
   [e]
-  (pretty-print-stacktrace e))
+  (stacktrace/print-cause-trace e))
 
 ; Load optional libraries
 (defmacro defoptional
-   [sym args & body]
-   `(let [docstring# (:doc (meta (var ~sym)))]
-      (defn ~sym ~args ~@body)
-      (alter-meta! (var ~sym) assoc :doc docstring#)))
-
-(try
-  (load "optional/prettyprint")
-  (catch Exception exc
-    (when-not (re-find #"Could not locate clojure/contrib/pprint__init.class or clojure/contrib/pprint.clj on classpath" (str exc))
-      (throw exc))))
-
-(def stacktrace-printer nil)
+  [sym args & body]
+  `(let [docstring# (:doc (meta (var ~sym)))]
+     (defn ~sym ~args ~@body)
+     (alter-meta! (var ~sym) assoc :doc docstring#)))
 
 (try
   (load "optional/clj_stacktrace")
   (catch Exception exc
     (when-not (re-find #"Could not locate clj_stacktrace/repl__init.class or clj_stacktrace/repl.clj on classpath" (str exc))
       (throw exc))))
-
-(when-not stacktrace-printer
-  (try
-    (load "optional/core_stacktrace")
-    (catch Exception exc
-      (when-not (re-find #"Could not locate clojure/stacktrace__init.class or clojure/stacktrace.clj on classpath" (str exc))
-        (throw exc)))))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.