        (.isAltDown event) "M"
        (.isControlDown event) "C"
        :else nil)
-     (if (= KeyEvent/CHAR_UNDEFINED key-char)
+     (if (special-codes key-code)
        (KeyEvent/getKeyText key-code)
        (str key-char))]))
 

  (reify KeyListener
    (keyReleased [this e] nil)
    (keyTyped [this e]
      (when (and @enable-advanced?
                 (get #{"(" ")" "[" "]" "{" "}" "\""}
                      (str (.getKeyChar e))))
        (.consume e)))
    (keyPressed [this e]
      (when-not (.isConsumed e)
        (let [k (convert-key-event e)
              p (exec-paredit k w buffer enable-default? enable-advanced?)]
          (when p (.consume e)))))))

(defn input-method-event-handler
  [w buffer enable-default? enable-advanced?]
  (reify InputMethodListener
    (inputMethodTextChanged [this e]
      (let [k (convert-input-method-event e)
            p (exec-paredit k w buffer enable-default? enable-advanced?)]
        (when p (.consume e))))))

(defn init-paredit!

   [nil "{"] :paredit-open-curly
   [nil "}"] :paredit-close-curly
   [nil "\b"] :paredit-backward-delete
   [nil "DEL"] :paredit-forward-delete
   [nil "\""] :paredit-doublequote ;; \"
   ; ["C" "K"] :paredit-kill
   ["M" "("] :paredit-wrap-round
   ; ["M" ")"] :paredit-close-round-and-newline
