    API for User Plugins."
   (:refer-clojure :exclude [send namespace])
   (:import [ccw.repl REPLView]))
+
+(defn active
+  "Return the active REPL"
+  [] (.get REPLView/activeREPL))
 
 (defn send
   "Send expression expr (a String) to repl (repl object obtained e.g. via an 

   print-to-log:     truthy if the expression should be logged in the log area
                     of the repl (defaults to true)
   repeat-last-eval: truthy if the preferences for repeating the last
                     user sent expression should be honored (defaults to false)"
  ([repl expr] (send repl expr false true false))
  ([repl expr add-to-history print-to-log repeat-last-eval]
    (when (and repl expr)
      (.evalExpression repl expr
        (boolean add-to-history)
        (boolean print-to-log)
        (boolean repeat-last-eval)))


(defn namespace!
  "Set the namespace (a String) for the repl"
  [repl namespace] (.setCurrentNamespace repl namespace))
