Skip to content

Commit

Permalink
[Fix trptcolin#150] Replace clojure-complete with compliment
Browse files Browse the repository at this point in the history
  • Loading branch information
Bozhidar Batsov committed Jul 25, 2014
1 parent dbb22a2 commit 0774c23
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[org.clojure/tools.cli "0.3.1"]
[com.cemerick/drawbridge "0.0.6"]
[trptcolin/versioneer "0.1.1"]
[clojure-complete "0.2.3"]
[compliment "0.1.1"]
[net.cgrand/sjacket "0.1.1"
:exclusions [org.clojure/clojure]]]
:min-lein-version "2.0.0"
Expand Down
6 changes: 3 additions & 3 deletions spec/reply/reader/jline/completion_spec.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

(describe "construct-possible-completions-form"
(it "does correct quoting in completions form request"
(should= '(complete.core/completions (str "clojure.core/map-") (symbol "user"))
(construct-possible-completions-form "clojure.core/map-" "user"))))
(should= '(compliment.core/completions (str "clojure.core/map-") (symbol "user") nil)
(construct-possible-completions-form "clojure.core/map-" "user"))))

(describe "using the completer"

Expand All @@ -17,7 +17,7 @@
(it "populates the list with possible completions"
(let [candidates (java.util.LinkedList.)
word-start (.complete @completer " (map" 5 candidates)]
(should= ["map" "map-indexed" "map?" "mapcat" "mapv"]
(should= ["map" "map?" "mapv" "mapcat" "map-indexed"]
candidates)
(should= 1 @@redraw-count)
(should= 2 word-start)))
Expand Down
14 changes: 6 additions & 8 deletions src/clj/reply/initialization.clj
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,10 @@

(defn completion-code []
`(try
(require '[complete.core])
; hack for 1.2 support until we release the next clojure-complete version
(require '[compliment.core])
~(export-definition 'reply.initialization/resolve-class)
(~'reply.exports/intern-with-meta
'~'complete.core '~'resolve-class ~'#'resolve-class)
'~'compliment.core '~'resolve-class ~'#'resolve-class)

(catch Exception e#
(try
Expand All @@ -161,12 +160,12 @@
(formify-file
(-> (Thread/currentThread)
(.getContextClassLoader)
(.getResource "complete/core.clj")))
(.getResource "compliment/core.clj")))
(catch Exception e
'(throw (Exception. "Couldn't find complete/core.clj")))))
'(throw (Exception. "Couldn't find compliment/core.clj")))))
(catch Exception f#
(intern (create-ns '~'complete.core) '~'completions
(fn [prefix# ns#] []))
(intern (create-ns '~'compliment.core) '~'completions
(fn [prefix# ns# context#] []))
(println "Unable to initialize completions."))))))

(defn default-init-code [{:keys [custom-help] :as options}]
Expand Down Expand Up @@ -228,4 +227,3 @@
~(when custom-eval custom-eval)
~(when custom-init custom-init)
nil))

4 changes: 2 additions & 2 deletions src/clj/reply/reader/jline/completion.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns reply.reader.jline.completion
(:require [reply.completion :as completion]
[complete.core])
[compliment.core])
(:import [jline.console.completer Completer]))

(defn construct-possible-completions-form [prefix ns]
`(~'complete.core/completions (~'str ~prefix) (~'symbol ~ns)))
`(~'compliment.core/completions (~'str ~prefix) (~'symbol ~ns) nil))

(defn get-prefix [buffer cursor]
(let [buffer (or buffer "")]
Expand Down

0 comments on commit 0774c23

Please sign in to comment.