Skip to content

Instantly share code, notes, and snippets.

@thumbnail
Last active November 6, 2019 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thumbnail/69a481ed397f2234ae97c2eb02f084ea to your computer and use it in GitHub Desktop.
Save thumbnail/69a481ed397f2234ae97c2eb02f084ea to your computer and use it in GitHub Desktop.
nrebl.middleware remove cursive noise
(alter-var-root 'nrebl.middleware/send-to-rebl!
                  (fn [send-to-rebl!]
                    (fn [{:keys [code op] :as req} {:keys [value] :as resp}]
                      (when-not (and (= op "eval")
                                     (clojure.string/starts-with? code "(cursive.repl"))
                        (send-to-rebl! req resp))
                      resp)))

use as an injection in your rebl profile;

 :rebl {:repl-options {:nrepl-middleware [nrebl.middleware/wrap-nrebl]}
        :dependencies [[rickmoynihan/nrebl.middleware "0.3.1"]
                       [org.clojure/core.async "0.4.490"]
                       [com.cognitect/rebl "0.9.220"]]
        :injections [(require '[cognitect.rebl :as rebl])
                     (alter-var-root #'nrebl.middleware/send-to-rebl!
                                     (fn [send-to-rebl!]
                                       (fn [{:keys [code op] :as req} {:keys [value] :as resp}]
                                         (when-not (and (= op "eval")
                                                        (clojure.string/starts-with? code "(cursive.repl"))
                                           (send-to-rebl! req resp))
                                         resp)))]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment