Skip to content
Browse files

Merge branch 'cake' of http://github.com/aria42/textmate-clojure into…

… merge-aria42
  • Loading branch information...
2 parents 52455b0 + 0731ee2 commit 1ab80b35b625fd30aeb7ac2a1a78a1364f780e5a @swannodette swannodette committed Sep 21, 2010
View
14 Support/bin/eval.clj
@@ -1,16 +1,18 @@
#!/usr/bin/env cake run
-(in-ns 'textmate)
-(clojure.core/refer 'clojure.core)
-(require '[clojure.string :as string])
(require '[clojure.java.io :as io])
(load-file (str (io/file (cake/*env* "TM_BUNDLE_SUPPORT") "utils.clj")))
-
-(textmate/attempt
+(in-ns 'textmate)
+(attempt
(clojure.core/println
"<pre>"
+ (get-selected-sexpr)
+ "<br>"
+ "<center>"
(-> (get-selected-sexpr)
clojure.core/eval
textmate/eval-in-file-ns
textmate/ppstr-nil
- textmate/htmlize)
+ textmate/htmlize
+ .trim)
+ "</center>"
"</pre>"))
View
11 Support/bin/eval_last_sexpr.clj
@@ -1,16 +1,17 @@
#!/usr/bin/env cake run
-(in-ns 'textmate)
-(clojure.core/refer 'clojure.core)
(require '[clojure.java.io :as io])
(load-file (str (io/file (cake/*env* "TM_BUNDLE_SUPPORT") "utils.clj")))
-
-
+(in-ns 'textmate)
(textmate/attempt
(clojure.core/println
"<pre>"
+ (get-last-sexpr)
+ "<br>"
+ "<center>"
(-> (get-last-sexpr)
clojure.core/eval
textmate/eval-in-file-ns
textmate/ppstr-nil
- textmate/htmlize)
+ textmate/htmlize
+ .trim)
"</pre>"))
View
4 Support/bin/eval_pprint.clj
@@ -1,9 +1,7 @@
#!/usr/bin/env cake run
-(in-ns 'textmate)
-(clojure.core/refer 'clojure.core)
-(require '[clojure.string :as string])
(require '[clojure.java.io :as io])
(load-file (str (io/file (cake/*env* "TM_BUNDLE_SUPPORT") "utils.clj")))
+(in-ns 'textmate)
(clojure.core/require '[clojure.pprint :as pprint])
(enter-file-ns)
View
6 Support/bin/jump_to_definition.clj
@@ -1,9 +1,7 @@
#!/usr/bin/env cake run
+(require '[clojure.java.io :as io])
+(load-file (str (io/file (cake/*env* "TM_BUNDLE_SUPPORT") "utils.clj")))
(in-ns 'textmate)
-(clojure.core/require '[clojure.contrib.repl-utils :as ru])
-(clojure.core/require '[clojure.java.io :as io])
-(clojure.core/load-file
- (clojure.core/str (io/file (cake/*env* "TM_BUNDLE_SUPPORT") "utils.clj")))
(when-let [symb (get-current-symbol)]
(when-let [{:keys [file line]} (meta symb)]
View
19 Support/bin/load_file.clj
@@ -1,20 +1,9 @@
#!/usr/bin/env cake run
-(in-ns 'textmate)
-(clojure.core/refer 'clojure.core)
-(require '[clojure.string :as string])
(require '[clojure.java.io :as io])
(load-file (str (io/file (cake/*env* "TM_BUNDLE_SUPPORT") "utils.clj")))
-
+(in-ns 'textmate)
(let [tm-filepath (cake/*env* "TM_FILEPATH")]
(if (not (= tm-filepath ""))
- (do
- (swap! *compiled-files* conj tm-filepath)
- (try
- (do
- (load-file tm-filepath)
- (clojure.core/println "<pre>Loading finished.</pre>"))
- (catch Exception e
- (do
- (clojure.core/println (with-out-str (stacktrace/print-stack-trace e)))
- (clojure.core/println "</pre>")))))
- (clojure.core/println "No file.")))
+ (attempt
+ (load-file tm-filepath)
+ (clojure.core/println "<pre>Loading finished.</pre>"))))
View
15 Support/bin/show_doc.clj
@@ -2,6 +2,7 @@
(in-ns 'textmate)
(clojure.core/require '[clojure.contrib.repl-utils :as ru])
(clojure.core/require '[clojure.java.io :as io])
+(clojure.core/require '[clojure.repl :as repl])
(clojure.core/load-file (clojure.core/str (io/file (cake/*env* "TM_BUNDLE_SUPPORT") "utils.clj")))
(textmate/attempt
@@ -17,10 +18,16 @@
(println (.replaceAll doc-str "\n" "<br>")))
(when-let [symb-ns (-> symb meta :ns)]
(println "<h1>Namespace</h1><br>"
- (.replaceAll
- (.replaceAll (str symb-ns) "<" "&lt;")
- ">" "&rt;")
- "<br>"))
+ (htmlize (str symb-ns))))
+ ; #_(.replaceAll
+ ; (.replaceAll (str symb-ns) "<" "&lt;")
+ ; ">" "&rt;")
+ ; #_"<br>"))
+ ; (when-let [cur-source (with-out-str (eval-in-file-ns (repl/source-fn (symbol name)))]
+ ; (println "<h1>Source</h1>"
+ ; "<pre>"
+ ; (htmlize cur-source)
+ ; "</pre>"))
(when-let [f (-> symb meta :file)]
(println "<h1>File</h1>")
(println
View
29 Support/utils.clj
@@ -1,12 +1,10 @@
-(in-ns 'textmate)
+(ns textmate
+ (:require [clojure.string :as string]
+ [clojure.java.io :as io]
+ [clojure.stacktrace :as stacktrace]
+ [clojure.contrib.seq-utils :as seq-utils]
+ [clojure.contrib.pprint :as pprint]))
(clojure.core/refer 'clojure.core)
-(require '[clojure.string :as string])
-(require '[clojure.java.io :as io])
-(require '[clojure.stacktrace :as stacktrace])
-(require '[clojure.contrib.seq-utils :as seq-utils])
-(require '[clojure.contrib.pprint :as pprint])
-
-(defonce *compiled-files* (atom #{}))
(defn htmlize [#^String text]
(-> text
@@ -48,7 +46,8 @@
(catch Exception e#
(clojure.core/println
"<pre>"
- (with-out-str (print-stack-trace (.getCause e#)))
+ "<b>Exception:</b>"
+ (with-out-str (stacktrace/print-stack-trace e#))
"</pre>"))))
(defn reader-empty? [#^java.io.PushbackReader rdr]
@@ -146,15 +145,9 @@
(.substring #^String (nth lines line-index) column-index)
(apply str (for [l (drop (inc line-index) lines)] (str l "\n"))))))
-;(defn make-cannonical-form-text [t]
-; (.replaceAll #^String t "\\s+" " "))
-
-;(defn str-escape [t]
-; (.replaceAll #^String t "\\n" "\\n"))
-
(defn symbol-char?
[c]
- (or (Character/isLetterOrDigit c) (#{\_ \! \. \? \- \/} c)))
+ (or (Character/isLetterOrDigit c) ((hash-set \_ \! \. \? \- \/) c)))
(defn get-current-symbol-str
"Get the string of the current symbol of the cursor"
@@ -227,6 +220,4 @@
(defn get-selected-sexpr
"Get highlighted sexpr"
[]
- (-> "TM_SELECTED_TEXT" cake/*env* escape-str clojure.core/read-string))
-
-(defn get-enclosing-sexpr [])
+ (-> "TM_SELECTED_TEXT" cake/*env* escape-str clojure.core/read-string))

0 comments on commit 1ab80b3

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