Is it possible to change the keyboard controls in Emacs Tetris?

I would like to change the keyboard controls for Emacs Tetris. Is this possible?

Answer

Meta-x apropos tetris

hmm…

tetris-move-bottom
tetris-move-left
tetris-move-right
tetris-rotate-next
tetris-rotate-prev

That looks promising… looking in tetris.el:

(defvar tetris-mode-map
  (make-sparse-keymap 'tetris-mode-map))

(define-key tetris-mode-map "n"     'tetris-start-game)
(define-key tetris-mode-map "q"     'tetris-end-game)
(define-key tetris-mode-map "p"     'tetris-pause-game)
(define-key tetris-mode-map " "     'tetris-move-bottom)
(define-key tetris-mode-map [left]  'tetris-move-left)
(define-key tetris-mode-map [right] 'tetris-move-right)
(define-key tetris-mode-map [up]    'tetris-rotate-prev)
(define-key tetris-mode-map [down]  'tetris-rotate-next)

redefine those and you are good to go.

Attribution
Source : Link , Question Author : rightfold , Answer Author : ccoakley

Leave a Comment