                            :length (- (.getSelectionEnd widget)
                                       (.getSelectionStart widget))})))
 
-(defn insert-result
+(defn insert-result!
   [w pe]
   (dorun
     (map #(if (= 0 (:length %))

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


   ["M" "r"] :paredit-raise-sexp
   ["C" "0"] :paredit-forward-slurp-sexp
   ["C" "9"] :paredit-backward-slurp-sexp
   ["C" "Open Bracket"] :paredit-backward-barf-sexp
   ["C" "Close Bracket"] :paredit-forward-barf-sexp
   ["M" "S"] :paredit-split-sexp
   ["M" "J"] :paredit-join-sexps
   ["M" "Left"] :paredit-expand-left
   ["M" "Right"] :paredit-expand-right})

(def ^:const advanced-alternate-keymap
  {[nil "⌫"] :paredit-backward-delete
   [nil "⌦"] :paredit-forward-delete
   ["C" "["] :paredit-backward-barf-sexp
   ["C" "]"] :paredit-forward-barf-sexp
   ["M" "←"] :paredit-expand-left
   ["M" "→"] :paredit-expand-right})

(def ^:const foreign-keymap
  {["M" "["] :paredit-open-square
