   (:use clojure.contrib.def)
   (:use clojure.test)
   (:use paredit.parser)
+  (:use clojure.set)
   (:require clojure.contrib.pprint)
   (:require [clojure.contrib.str-utils2 :as str2])
   (:require [clojure.zip :as zip]))

  :paredit-open-round
  [cmd {:keys [text offset length] :as t}]
  (open-balanced [\( \)] t 
    (into *real-spaces* *open-brackets*)
    (into *extended-spaces* *close-brackets*)))
    
(defmethod paredit 
  :paredit-open-square
  [cmd {:keys [text offset length] :as t}]
  (open-balanced [\[ \]] t
    (into *real-spaces* *open-brackets*)
    (into *extended-spaces* *close-brackets*)))
    
(defmethod paredit 
  :paredit-open-curly
  [cmd {:keys [text offset length] :as t}]
  (open-balanced [\{ \}] t
    (conj (into *real-spaces* *open-brackets*) \#) ; add # for not inserting space before a set FIXME
    (into *extended-spaces* *close-brackets*)))
    
(defmethod paredit 

  ([{:keys [#^String text offset length] :as t}] (previous-char t 1))
  ([{:keys [#^String text offset length] :as t} n]
    (assert (>= length 0))
    (when (< -1 (- offset n) (.length text))
      (.charAt text (- offset n)))))
  
(defn next-char [{:keys [#^String text offset length] :as t}]
  (assert (>= length 0))
  (when (< -1 (+ offset length) (.length text))
    (.charAt text (+ offset length))))
  
(defmulti paredit (fn [k & args] k))
