Skip to content
Browse files

Push everything back to 80 chars per line

  • Loading branch information...
1 parent c139881 commit 565eff02e8d833e3bf4cf36ce0f7510d71267a1c @trptcolin committed
View
29 src/clj/reply/eval_modes/nrepl.clj
@@ -80,21 +80,25 @@
next-text)))]
(if (or interrupted? (empty? (:content parse-tree)))
(list "")
- (let [completed? (fn [node]
- (or (not= :net.cgrand.parsley/unfinished (:tag node))
- (some #(= :net.cgrand.parsley/unexpected (:tag %))
- (tree-seq :tag :content node))))
+ (let [completed?
+ (fn [node]
+ (or (not= :net.cgrand.parsley/unfinished (:tag node))
+ (some #(= :net.cgrand.parsley/unexpected (:tag %))
+ (tree-seq :tag :content node))))
complete-forms (take-while completed? (:content parse-tree))
remainder (drop-while completed? (:content parse-tree))
form-strings (map sjacket/str-pt
- (remove #(contains? #{:whitespace :comment :discard}
- (:tag %))
+ (remove #(contains?
+ #{:whitespace :comment :discard}
+ (:tag %))
complete-forms))]
(cond (seq remainder)
(lazy-seq
(concat form-strings
- (parsed-forms request-exit
- (apply str (map sjacket/str-pt remainder)))))
+ (parsed-forms
+ request-exit
+ (apply str (map sjacket/str-pt
+ remainder)))))
(seq form-strings)
form-strings
:else
@@ -154,11 +158,13 @@
(read-string @results)))
(defn poll-for-responses [connection]
- (try (when-let [{:keys [out err] :as resp} (nrepl.transport/recv connection 100)]
+ (try (when-let [{:keys [out err] :as resp}
+ (nrepl.transport/recv connection 100)]
(when err (print err))
(when out (print out))
(when-not (or err out)
- (.offer ^LinkedBlockingQueue (@response-queues (:session resp)) resp))
+ (.offer ^LinkedBlockingQueue (@response-queues (:session resp))
+ resp))
(flush))
(catch Throwable t
(clojure.repl/pst t)
@@ -194,7 +200,8 @@
(reply.initialization/export-definition
'reply.signals/set-signal-handler!)
'(set-signal-handler! "INT" (fn [s]))
- (reply.initialization/construct-init-code options)))))
+ (reply.initialization/construct-init-code
+ options)))))
(handle-client-interruption! client)
(run-repl client options))))
View
2 src/clj/reply/eval_modes/standalone/concurrency.clj
@@ -29,7 +29,7 @@
(Thread/sleep 2000)
(when (and @action (not (:completed @action)) (.isAlive thread))
(println ";;;;;;;;;;")
- (println "; Sorry, have to call Thread.stop on this command, because it's not dying.")
+ (println "; Sorry, have to call Thread.stop on this command.")
(println ";;;;;;;;;;")
(.stop thread)))))
View
3 src/clj/reply/eval_state.clj
@@ -9,7 +9,8 @@
#'clojure.core/*print-meta* *print-meta*
#'clojure.core/*print-length* *print-length*
#'clojure.core/*print-level* *print-level*
- #'clojure.core/*compile-path* (System/getProperty "clojure.compile.path" "classes")
+ #'clojure.core/*compile-path* (System/getProperty
+ "clojure.compile.path" "classes")
#'clojure.core/*command-line-args* *command-line-args*
#'clojure.core/*unchecked-math* *unchecked-math*
#'clojure.core/*assert* *assert*
View
6 src/clj/reply/hacks/printing.clj
@@ -4,8 +4,10 @@
"The monkey-patch here is to be a good citizen in the face of thread
interruption. Only the (when (Thread/interrupted) ...) forms are
different from the clojure.core implementation."
- [^String begin, print-one, ^String sep, ^String end, sequence, ^java.io.Writer w]
- (binding [*print-level* (and (not *print-dup*) *print-level* (dec *print-level*))]
+ [^String begin, print-one, ^String sep,
+ ^String end, sequence, ^java.io.Writer w]
+ (binding [*print-level* (and (not *print-dup*)
+ *print-level* (dec *print-level*))]
(if (and *print-level* (neg? *print-level*))
(.write w "#")
(do
View
9 src/clj/reply/initialization.clj
@@ -5,8 +5,10 @@
(defmacro repl-defn [sym & args]
(let [no-meta-source (binding [*print-meta* true]
- (with-out-str (clojure.pprint/pprint `(defn ~sym ~@args))))
- meta-source `(clojure.core/defn ~(vary-meta sym assoc :source no-meta-source) ~@args)]
+ (with-out-str
+ (clojure.pprint/pprint `(defn ~sym ~@args))))
+ meta-source `(clojure.core/defn
+ ~(vary-meta sym assoc :source no-meta-source) ~@args)]
meta-source))
(defmacro sourcery [name]
@@ -52,7 +54,8 @@
(require '[cd-client.core])
true
(catch Exception e#
- (println "Warning: Could not load the ClojureDocs client, so `clojuredocs` will be unavailable")
+ (println "Warning: Could not load the ClojureDocs client, so"
+ "`clojuredocs` will be unavailable")
(println " Details:" e# "\n")
false))))
View
29 src/clj/reply/main.clj
@@ -14,14 +14,23 @@
(defn parse-args [args]
(cli/cli args
["-h" "--help" "Show this help screen" :flag true]
- ["-e" "--eval" "--custom-eval" "Provide a custom form on the command line to evaluate in the user ns" :parse-fn read-string]
- ["-i" "--init" "--custom-init" "Provide a Clojure file to evaluate in the user ns" :parse-fn initialization/formify-file]
- ["--standalone" "Launch standalone mode instead of the default nREPL" :flag true]
- ["--color" "Use color; currently only available with nREPL" :flag true]
- ["--skip-default-init" "Skip the default initialization code" :flag true]
+ ["-e" "--eval" "--custom-eval"
+ "Provide a custom form to evaluate in the user ns"
+ :parse-fn read-string]
+ ["-i" "--init" "--custom-init"
+ "Provide a Clojure file to evaluate in the user ns"
+ :parse-fn initialization/formify-file]
+ ["--standalone" "Launch standalone mode instead of the default nREPL"
+ :flag true]
+ ["--color" "Use color; currently only available with nREPL"
+ :flag true]
+ ["--skip-default-init" "Skip the default initialization code"
+ :flag true]
["--history-file" "Provide a path for the history file"]
- ["--prompt" "--custom-prompt" "Provide a custom prompt function" :parse-fn read-string]
- ["--attach" "Attach to an existing nREPL session on this port or host:port, when used with nREPL"]
+ ["--prompt" "--custom-prompt" "Provide a custom prompt function"
+ :parse-fn read-string]
+ ["--attach"
+ "Attach to an existing nREPL session on this port or host:port"]
["--port" "Start new nREPL server on this port"]))
(defn handle-resume [signal]
@@ -30,7 +39,8 @@
(defmacro with-launching-context [options & body]
`(try
- (.addShutdownHook (Runtime/getRuntime) (Thread. #(reader.jline/shutdown-reader)))
+ (.addShutdownHook (Runtime/getRuntime)
+ (Thread. #(reader.jline/shutdown-reader)))
(signals/set-signal-handler! "CONT" handle-resume)
(with-redefs [clojure.core/print-sequential hacks.printing/print-sequential
clojure.repl/pst clj-stacktrace.repl/pst]
@@ -42,7 +52,8 @@
(let [status# (:status (:object (ex-data e#)))
body# (:body (:object (ex-data e#)))]
(cond (= 401 status#) (println "Unauthorized.")
- (number? status#) (println "Remote error:" (slurp ~body))
+ (number? status#) (println "Remote error:"
+ (slurp ~body))
:else (clojure.repl/pst e#)))))
'(catch Throwable t# (clojure.repl/pst t#))])
(finally (exit/exit))))
View
18 src/clj/reply/reader/jline.clj
@@ -14,7 +14,8 @@
(def jline-pushback-reader (atom nil))
(defn print-interruption []
- (when-not (#{"none" "off" "false"} (.getProperty (Configuration/getProperties) "jline.terminal"))
+ (when-not (#{"none" "off" "false"}
+ (.getProperty (Configuration/getProperties) "jline.terminal"))
(print "^C")
(flush)))
@@ -32,7 +33,8 @@
(.setProperty (Configuration/getProperties) "jline.terminal" "none"))
(let [reader (ConsoleReader.)
history (FileHistory. (make-history-file (:history-file options)))
- completer (jline.completion/make-completer reply.initialization/eval-in-user-ns #())]
+ completer (jline.completion/make-completer
+ reply.initialization/eval-in-user-ns #())]
(.setBlinkMatchingParen (.getKeys reader) true)
(.setHandleUserInterrupt reader true)
(doto reader
@@ -66,8 +68,10 @@
(defn setup-reader! [options]
(when-not (System/getenv "JLINE_LOGGING")
(Log/setOutput (PrintStream. (ByteArrayOutputStream.))))
- (reset! jline-reader (make-reader options)) ; since construction is side-effect-y
- (reset! jline-pushback-reader ; since this depends on jline-reader
+ ; since construction is side-effect-y
+ (reset! jline-reader (make-reader options))
+ ; since this depends on jline-reader
+ (reset! jline-pushback-reader
(CustomizableBufferLineNumberingPushbackReader.
(JlineInputReader.
{:jline-reader @jline-reader
@@ -105,13 +109,15 @@
(defmacro with-jline-in [& body]
`(do
(try
- (prepare-for-read reply.initialization/eval-in-user-ns (eval-state/get-ns))
+ (prepare-for-read reply.initialization/eval-in-user-ns
+ (eval-state/get-ns))
(binding [*in* @jline-pushback-reader]
(Thread/interrupted) ; just to clear the status
~@body)
; NOTE: this indirection is for wrapped exceptions in 1.3
(catch Throwable e#
- (if (#{IOException InterruptedException} (type (clojure.main/repl-exception e#)))
+ (if (#{IOException InterruptedException}
+ (type (clojure.main/repl-exception e#)))
(do (reset-reader) nil)
(throw e#))))))
View
3 src/clj/reply/reader/jline/completion.clj
@@ -12,7 +12,8 @@
(let [buffer (or buffer "")
prefix (or (completion/get-word-ending-at buffer cursor) "")
prefix-length (.length prefix)
- possible-completions-form (construct-possible-completions-form prefix)
+ possible-completions-form (construct-possible-completions-form
+ prefix)
possible-completions (eval-fn possible-completions-form)]
(if (or (empty? possible-completions) (zero? prefix-length))
-1

0 comments on commit 565eff0

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