    ["M" "{"] :paredit-open-curly
    ["M" "}"] :paredit-close-curly})
 
-(def ^:const special-codes
-  #{KeyEvent/VK_LEFT_PARENTHESIS
-    KeyEvent/VK_RIGHT_PARENTHESIS
-    KeyEvent/VK_OPEN_BRACKET
-    KeyEvent/VK_CLOSE_BRACKET
-    KeyEvent/VK_BRACELEFT
-    KeyEvent/VK_BRACERIGHT
-    KeyEvent/VK_BACK_SPACE
-    KeyEvent/VK_DELETE
-    KeyEvent/VK_QUOTEDBL
-    KeyEvent/VK_LEFT
-    KeyEvent/VK_RIGHT})
-
-(defn exec-paredit!
+(defn exec-paredit
   [k w buffer enable-default? enable-advanced?]
   (when-let [cmd (or (and enable-default?
                           (default-keymap k))
                      (and @enable-advanced?
                           (or (advanced-keymap k)
-                              (advanced-alternate-keymap k)
                               (foreign-keymap k))))]
-    (insert-result! w (exec-command cmd w buffer))
+    (let [result (exec-command cmd w buffer)]
+      (insert-result w result))
     cmd))
+
+(defn convert-input-method-event
+  [event]
+  ["M" (os-x-charmap (str (.first (.getText event))))])
 
 (defn convert-key-event
   [event]

   [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

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

