diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-11-20 11:00:19 +0100 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-11-20 12:55:37 +0100 |
commit | 67e06d692a655985f9e7406e81d717639938427b (patch) | |
tree | 42c8e712d942519ecd6375d71123605c56c8187a /lisp/play/snake.el | |
parent | 5cb003c31c2484ec4281631df6a4c84631dbecc8 (diff) | |
download | emacs-67e06d692a655985f9e7406e81d717639938427b.tar.gz |
Convert snake and tetris keymaps to defvar-keymap
* lisp/play/snake.el (snake-mode-map, snake-null-map):
* lisp/play/tetris.el (tetris-mode-map, tetris-null-map): Convert
to defvar-keymap.
Diffstat (limited to 'lisp/play/snake.el')
-rw-r--r-- | lisp/play/snake.el | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/lisp/play/snake.el b/lisp/play/snake.el index 29effa23460..dbdecde973d 100644 --- a/lisp/play/snake.el +++ b/lisp/play/snake.el @@ -160,31 +160,28 @@ and then start moving it leftwards.") ;; ;;;;;;;;;;;;; keymaps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defvar snake-mode-map - (let ((map (make-sparse-keymap 'snake-mode-map))) - - (define-key map "n" 'snake-start-game) - (define-key map "q" 'snake-end-game) - (define-key map "p" 'snake-pause-game) - - (define-key map [left] 'snake-move-left) - (define-key map [right] 'snake-move-right) - (define-key map [up] 'snake-move-up) - (define-key map [down] 'snake-move-down) - - (define-key map "\C-b" 'snake-move-left) - (define-key map "\C-f" 'snake-move-right) - (define-key map "\C-p" 'snake-move-up) - (define-key map "\C-n" 'snake-move-down) - map) - "Keymap for Snake games.") - -(defvar snake-null-map - (let ((map (make-sparse-keymap 'snake-null-map))) - (define-key map "n" 'snake-start-game) - (define-key map "q" 'quit-window) - map) - "Keymap for finished Snake games.") +(defvar-keymap snake-mode-map + :doc "Keymap for Snake games." + :name 'snake-mode-map + "n" #'snake-start-game + "q" #'snake-end-game + "p" #'snake-pause-game + + "<left>" #'snake-move-left + "<right>" #'snake-move-right + "<up>" #'snake-move-up + "<down>" #'snake-move-down + + "C-b" #'snake-move-left + "C-f" #'snake-move-right + "C-p" #'snake-move-up + "C-n" #'snake-move-down) + +(defvar-keymap snake-null-map + :doc "Keymap for finished Snake games." + :name 'snake-null-map + "n" #'snake-start-game + "q" #'quit-window) (defconst snake--menu-def '("Snake" |