migrating keypressed event handler to clojure