summaryrefslogtreecommitdiff
path: root/lisp/play
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-12-31 17:17:16 +0100
committerStefan Kangas <stefan@marxist.se>2021-12-31 17:17:16 +0100
commit4521a3a19c123c43f4bb7ad21a94456434ef81f4 (patch)
tree30a6a9df55f8df798b5665550851a86259dd0484 /lisp/play
parentc09fcb8f07c1fa6864a38c28e3f27298136b8b8e (diff)
downloademacs-4521a3a19c123c43f4bb7ad21a94456434ef81f4.tar.gz
Use defvar-keymap in play/*.el
* lisp/play/5x5.el (5x5-mode-map): * lisp/play/blackbox.el (blackbox-mode-map): * lisp/play/bubbles.el (bubbles-mode-map): * lisp/play/decipher.el (decipher-mode-map): * lisp/play/doctor.el (doctor-mode-map): * lisp/play/gametree.el (gametree-mode-map): * lisp/play/gomoku.el (gomoku-mode-map): * lisp/play/mpuz.el (mpuz-mode-map): * lisp/play/pong.el (pong-mode-map): * lisp/play/solitaire.el (solitaire-mode-map): Use defvar-keymap.
Diffstat (limited to 'lisp/play')
-rw-r--r--lisp/play/5x5.el64
-rw-r--r--lisp/play/blackbox.el32
-rw-r--r--lisp/play/bubbles.el31
-rw-r--r--lisp/play/decipher.el55
-rw-r--r--lisp/play/doctor.el8
-rw-r--r--lisp/play/gametree.el34
-rw-r--r--lisp/play/gomoku.el114
-rw-r--r--lisp/play/mpuz.el17
-rw-r--r--lisp/play/pong.el34
-rw-r--r--lisp/play/solitaire.el82
10 files changed, 221 insertions, 250 deletions
diff --git a/lisp/play/5x5.el b/lisp/play/5x5.el
index 085c97f5d8e..155c08f0ade 100644
--- a/lisp/play/5x5.el
+++ b/lisp/play/5x5.el
@@ -107,39 +107,37 @@
(defvar 5x5-buffer-name "*5x5*"
"Name of the 5x5 play buffer.")
-(defvar 5x5-mode-map
- (let ((map (make-sparse-keymap)))
- (suppress-keymap map t)
- (define-key map "?" #'describe-mode)
- (define-key map "\r" #'5x5-flip-current)
- (define-key map " " #'5x5-flip-current)
- (define-key map [up] #'5x5-up)
- (define-key map [down] #'5x5-down)
- (define-key map [left] #'5x5-left)
- (define-key map [tab] #'5x5-right)
- (define-key map [right] #'5x5-right)
- (define-key map [(control a)] #'5x5-bol)
- (define-key map [(control e)] #'5x5-eol)
- (define-key map [(control p)] #'5x5-up)
- (define-key map [(control n)] #'5x5-down)
- (define-key map [(control b)] #'5x5-left)
- (define-key map [(control f)] #'5x5-right)
- (define-key map [home] #'5x5-bol)
- (define-key map [end] #'5x5-eol)
- (define-key map [prior] #'5x5-first)
- (define-key map [next] #'5x5-last)
- (define-key map "r" #'5x5-randomize)
- (define-key map [(control c) (control r)] #'5x5-crack-randomly)
- (define-key map [(control c) (control c)] #'5x5-crack-mutating-current)
- (define-key map [(control c) (control b)] #'5x5-crack-mutating-best)
- (define-key map [(control c) (control x)] #'5x5-crack-xor-mutate)
- (define-key map "n" #'5x5-new-game)
- (define-key map "s" #'5x5-solve-suggest)
- (define-key map "<" #'5x5-solve-rotate-left)
- (define-key map ">" #'5x5-solve-rotate-right)
- (define-key map "q" #'5x5-quit-game)
- map)
- "Local keymap for the 5x5 game.")
+(defvar-keymap 5x5-mode-map
+ :doc "Local keymap for the 5x5 game."
+ :suppress 'nodigits
+ "?" #'describe-mode
+ "RET" #'5x5-flip-current
+ "SPC" #'5x5-flip-current
+ "<up>" #'5x5-up
+ "<down>" #'5x5-down
+ "<left>" #'5x5-left
+ "<tab>" #'5x5-right
+ "<right>" #'5x5-right
+ "C-a" #'5x5-bol
+ "C-e" #'5x5-eol
+ "C-p" #'5x5-up
+ "C-n" #'5x5-down
+ "C-b" #'5x5-left
+ "C-f" #'5x5-right
+ "<home>" #'5x5-bol
+ "<end>" #'5x5-eol
+ "<prior>" #'5x5-first
+ "<next>" #'5x5-last
+ "r" #'5x5-randomize
+ "C-c C-r" #'5x5-crack-randomly
+ "C-c C-c" #'5x5-crack-mutating-current
+ "C-c C-b" #'5x5-crack-mutating-best
+ "C-c C-x" #'5x5-crack-xor-mutate
+ "n" #'5x5-new-game
+ "s" #'5x5-solve-suggest
+ "<" #'5x5-solve-rotate-left
+ ">" #'5x5-solve-rotate-right
+ "q" #'5x5-quit-game)
(defvar-local 5x5-solver-output nil
"List that is the output of an arithmetic solver.
diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el
index 1b82d1a4259..d9375502089 100644
--- a/lisp/play/blackbox.el
+++ b/lisp/play/blackbox.el
@@ -85,23 +85,21 @@
(defvar bb-balls-placed nil
"List of already placed balls.")
-(defvar blackbox-mode-map
- (let ((map (make-sparse-keymap)))
- (suppress-keymap map t)
- (define-key map " " 'bb-romp)
- (define-key map "q" 'bury-buffer)
- (define-key map [insert] 'bb-romp)
- (define-key map [return] 'bb-done)
- (define-key map [remap backward-char] #'bb-left)
- (define-key map [remap left-char] #'bb-left)
- (define-key map [remap forward-char] #'bb-right)
- (define-key map [remap right-char] #'bb-right)
- (define-key map [remap previous-line] #'bb-up)
- (define-key map [remap next-line] #'bb-down)
- (define-key map [remap move-end-of-line] #'bb-eol)
- (define-key map [remap move-beginning-of-line] #'bb-bol)
- (define-key map [remap newline] #'bb-done)
- map))
+(defvar-keymap blackbox-mode-map
+ :suppress 'nodigits
+ "SPC" #'bb-romp
+ "q" #'bury-buffer
+ "<insert>" #'bb-romp
+ "<return>" #'bb-done
+ "<remap> <backward-char>" #'bb-left
+ "<remap> <left-char>" #'bb-left
+ "<remap> <forward-char>" #'bb-right
+ "<remap> <right-char>" #'bb-right
+ "<remap> <previous-line>" #'bb-up
+ "<remap> <next-line>" #'bb-down
+ "<remap> <move-end-of-line>" #'bb-eol
+ "<remap> <move-beginning-of-line>" #'bb-bol
+ "<remap> <newline>" #'bb-done)
;; Blackbox mode is suitable only for specially formatted data.
diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el
index e695a75e083..471dea8d580 100644
--- a/lisp/play/bubbles.el
+++ b/lisp/play/bubbles.el
@@ -809,22 +809,21 @@ static char * dot3d_xpm[] = {
(bubbles--update-faces-or-images))
-(defvar bubbles-mode-map
- (let ((map (make-sparse-keymap 'bubbles-mode-map)))
- ;; (suppress-keymap map t)
- (define-key map "q" 'bubbles-quit)
- (define-key map "\n" 'bubbles-plop)
- (define-key map " " 'bubbles-plop)
- (define-key map [double-down-mouse-1] 'bubbles-plop)
- (define-key map [mouse-2] 'bubbles-plop)
- (define-key map "\C-m" 'bubbles-plop)
- (define-key map "u" 'bubbles-undo)
- (define-key map "p" 'previous-line)
- (define-key map "n" 'next-line)
- (define-key map "f" 'forward-char)
- (define-key map "b" 'backward-char)
- map)
- "Mode map for `bubbles'.")
+(defvar-keymap bubbles-mode-map
+ :doc "Mode map for `bubbles'."
+ :name 'bubbles-mode-map
+ "q" #'bubbles-quit
+ "C-j" #'bubbles-plop
+ "SPC" #'bubbles-plop
+ "C-m" #'bubbles-plop
+ "u" #'bubbles-undo
+ "p" #'previous-line
+ "n" #'next-line
+ "f" #'forward-char
+ "b" #'backward-char
+
+ "<double-down-mouse-1>" #'bubbles-plop
+ "<mouse-2>" #'bubbles-plop)
(easy-menu-define bubbles-menu bubbles-mode-map
"Menu for `bubbles'."
diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el
index 5431d7f068a..613f254fd2d 100644
--- a/lisp/play/decipher.el
+++ b/lisp/play/decipher.el
@@ -138,36 +138,31 @@ the tail of the list."
(2 font-lock-string-face)))
"Font Lock keywords for Decipher mode.")
-(defvar decipher-mode-map
- (let ((map (make-keymap)))
- (suppress-keymap map)
- (define-key map "A" #'decipher-show-alphabet)
- (define-key map "C" #'decipher-complete-alphabet)
- (define-key map "D" #'decipher-digram-list)
- (define-key map "F" #'decipher-frequency-count)
- (define-key map "M" #'decipher-make-checkpoint)
- (define-key map "N" #'decipher-adjacency-list)
- (define-key map "R" #'decipher-restore-checkpoint)
- (define-key map "U" #'decipher-undo)
- (define-key map " " #'decipher-keypress)
- (define-key map [remap undo] #'decipher-undo)
- (define-key map [remap advertised-undo] #'decipher-undo)
- (let ((key ?a))
- (while (<= key ?z)
- (define-key map (vector key) #'decipher-keypress)
- (cl-incf key)))
- map)
- "Keymap for Decipher mode.")
-
-
-(defvar decipher-stats-mode-map
- (let ((map (make-keymap)))
- (suppress-keymap map)
- (define-key map "D" #'decipher-digram-list)
- (define-key map "F" #'decipher-frequency-count)
- (define-key map "N" #'decipher-adjacency-list)
- map)
- "Keymap for Decipher-Stats mode.")
+(defvar-keymap decipher-mode-map
+ :doc "Keymap for Decipher mode."
+ :suppress t
+ "A" #'decipher-show-alphabet
+ "C" #'decipher-complete-alphabet
+ "D" #'decipher-digram-list
+ "F" #'decipher-frequency-count
+ "M" #'decipher-make-checkpoint
+ "N" #'decipher-adjacency-list
+ "R" #'decipher-restore-checkpoint
+ "U" #'decipher-undo
+ "SPC" #'decipher-keypress
+ "<remap> <undo>" #'decipher-undo
+ "<remap> <advertised-undo>" #'decipher-undo)
+(let ((key ?a))
+ (while (<= key ?z)
+ (keymap-set decipher-mode-map (char-to-string key) #'decipher-keypress)
+ (cl-incf key)))
+
+(defvar-keymap decipher-stats-mode-map
+ :doc "Keymap for Decipher-Stats mode."
+ :suppress t
+ "D" #'decipher-digram-list
+ "F" #'decipher-frequency-count
+ "N" #'decipher-adjacency-list)
(defvar decipher-mode-syntax-table
diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el
index 33fecaa188a..e45619d1c79 100644
--- a/lisp/play/doctor.el
+++ b/lisp/play/doctor.el
@@ -126,11 +126,9 @@
(set what ww)
first))
-(defvar doctor-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map "\n" 'doctor-read-print)
- (define-key map "\r" 'doctor-ret-or-read)
- map))
+(defvar-keymap doctor-mode-map
+ "C-j" #'doctor-read-print
+ "RET" #'doctor-ret-or-read)
(define-derived-mode doctor-mode text-mode "Doctor"
"Major mode for running the Doctor (Eliza) program.
diff --git a/lisp/play/gametree.el b/lisp/play/gametree.el
index ff4b97d884c..b7ebe3dcd3a 100644
--- a/lisp/play/gametree.el
+++ b/lisp/play/gametree.el
@@ -580,26 +580,20 @@ buffer, it is replaced by the new value. See the documentation for
;;;; Key bindings
-(defvar gametree-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map "\C-c\C-j" 'gametree-break-line-here)
- (define-key map "\C-c\C-v" 'gametree-insert-new-leaf)
- (define-key map "\C-c\C-m" 'gametree-merge-line)
- (define-key map "\C-c\C-r " 'gametree-layout-to-register)
- (define-key map "\C-c\C-r/" 'gametree-layout-to-register)
- (define-key map "\C-c\C-rj" 'gametree-apply-register-layout)
- (define-key map "\C-c\C-y" 'gametree-save-and-hack-layout)
- (define-key map "\C-c;" 'gametree-insert-score)
- (define-key map "\C-c^" 'gametree-compute-and-insert-score)
- (define-key map [M-down-mouse-2 M-mouse-2]
- #'gametree-mouse-break-line-here)
- (define-key map [S-down-mouse-1 S-mouse-1]
- #'gametree-mouse-show-children-and-entry)
- (define-key map [S-down-mouse-2 S-mouse-2]
- #'gametree-mouse-show-subtree)
- (define-key map [S-down-mouse-3 S-mouse-3]
- #'gametree-mouse-hide-subtree)
- map))
+(defvar-keymap gametree-mode-map
+ "C-c C-j" #'gametree-break-line-here
+ "C-c C-v" #'gametree-insert-new-leaf
+ "C-c C-m" #'gametree-merge-line
+ "C-c C-r SPC" #'gametree-layout-to-register
+ "C-c C-r /" #'gametree-layout-to-register
+ "C-c C-r j" #'gametree-apply-register-layout
+ "C-c C-y" #'gametree-save-and-hack-layout
+ "C-c ;" #'gametree-insert-score
+ "C-c ^" #'gametree-compute-and-insert-score
+ "M-<down-mouse-2> M-<mouse-2>" #'gametree-mouse-break-line-here
+ "S-<down-mouse-1> S-<mouse-1>" #'gametree-mouse-show-children-and-entry
+ "S-<down-mouse-2> S-<mouse-2>" #'gametree-mouse-show-subtree
+ "S-<down-mouse-3> S-<mouse-3>" #'gametree-mouse-hide-subtree)
(define-derived-mode gametree-mode outline-mode "GameTree"
"Major mode for managing game analysis trees.
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el
index 0a45885b875..97726fcad76 100644
--- a/lisp/play/gomoku.el
+++ b/lisp/play/gomoku.el
@@ -100,65 +100,61 @@ SHOULD be at least 2 (MUST BE at least 1).")
"Number of lines between the Gomoku board and the top of the window.")
-(defvar gomoku-mode-map
- (let ((map (make-sparse-keymap)))
-
- ;; Key bindings for cursor motion.
- (define-key map "y" 'gomoku-move-nw) ; y
- (define-key map "u" 'gomoku-move-ne) ; u
- (define-key map "b" 'gomoku-move-sw) ; b
- (define-key map "n" 'gomoku-move-se) ; n
- (define-key map "h" 'gomoku-move-left) ; h
- (define-key map "l" 'gomoku-move-right) ; l
- (define-key map "j" 'gomoku-move-down) ; j
- (define-key map "k" 'gomoku-move-up) ; k
-
- (define-key map [kp-7] 'gomoku-move-nw)
- (define-key map [kp-9] 'gomoku-move-ne)
- (define-key map [kp-1] 'gomoku-move-sw)
- (define-key map [kp-3] 'gomoku-move-se)
- (define-key map [kp-4] 'gomoku-move-left)
- (define-key map [kp-6] 'gomoku-move-right)
- (define-key map [kp-2] 'gomoku-move-down)
- (define-key map [kp-8] 'gomoku-move-up)
-
- (define-key map "\C-b" 'gomoku-move-left) ; C-b
- (define-key map "\C-f" 'gomoku-move-right) ; C-f
- (define-key map "\C-n" 'gomoku-move-down) ; C-n
- (define-key map "\C-p" 'gomoku-move-up) ; C-p
-
- ;; Key bindings for entering Human moves.
- (define-key map "X" 'gomoku-human-plays) ; X
- (define-key map "x" 'gomoku-human-plays) ; x
- (define-key map " " 'gomoku-human-plays) ; SPC
- (define-key map "\C-m" 'gomoku-human-plays) ; RET
- (define-key map "\C-c\C-p" 'gomoku-human-plays) ; C-c C-p
- (define-key map "\C-c\C-b" 'gomoku-human-takes-back) ; C-c C-b
- (define-key map "\C-c\C-r" 'gomoku-human-resigns) ; C-c C-r
- (define-key map "\C-c\C-e" 'gomoku-emacs-plays) ; C-c C-e
-
- (define-key map [kp-enter] 'gomoku-human-plays)
- (define-key map [insert] 'gomoku-human-plays)
- (define-key map [down-mouse-1] 'gomoku-click)
- (define-key map [drag-mouse-1] 'gomoku-click)
- (define-key map [mouse-1] 'gomoku-click)
- (define-key map [down-mouse-2] 'gomoku-click)
- (define-key map [mouse-2] 'gomoku-mouse-play)
- (define-key map [drag-mouse-2] 'gomoku-mouse-play)
-
- (define-key map [remap backward-char] 'gomoku-move-left)
- (define-key map [remap left-char] 'gomoku-move-left)
- (define-key map [remap forward-char] 'gomoku-move-right)
- (define-key map [remap right-char] 'gomoku-move-right)
- (define-key map [remap previous-line] 'gomoku-move-up)
- (define-key map [remap next-line] 'gomoku-move-down)
- (define-key map [remap move-beginning-of-line] 'gomoku-beginning-of-line)
- (define-key map [remap move-end-of-line] 'gomoku-end-of-line)
- (define-key map [remap undo] 'gomoku-human-takes-back)
- (define-key map [remap advertised-undo] 'gomoku-human-takes-back)
- map)
-
- "Local keymap to use in Gomoku mode.")
+(defvar-keymap gomoku-mode-map
+ :doc "Local keymap to use in Gomoku mode."
+ ;; Key bindings for cursor motion.
+ "y" #'gomoku-move-nw
+ "u" #'gomoku-move-ne
+ "b" #'gomoku-move-sw
+ "n" #'gomoku-move-se
+ "h" #'gomoku-move-left
+ "l" #'gomoku-move-right
+ "j" #'gomoku-move-down
+ "k" #'gomoku-move-up
+
+ "<kp-7>" #'gomoku-move-nw
+ "<kp-9>" #'gomoku-move-ne
+ "<kp-1>" #'gomoku-move-sw
+ "<kp-3>" #'gomoku-move-se
+ "<kp-4>" #'gomoku-move-left
+ "<kp-6>" #'gomoku-move-right
+ "<kp-2>" #'gomoku-move-down
+ "<kp-8>" #'gomoku-move-up
+
+ "C-b" #'gomoku-move-left
+ "C-f" #'gomoku-move-right
+ "C-n" #'gomoku-move-down
+ "C-p" #'gomoku-move-up
+
+ ;; Key bindings for entering Human moves.
+ "X" #'gomoku-human-plays
+ "x" #'gomoku-human-plays
+ "SPC" #'gomoku-human-plays
+ "RET" #'gomoku-human-plays
+ "C-c C-p" #'gomoku-human-plays
+ "C-c C-b" #'gomoku-human-takes-back
+ "C-c C-r" #'gomoku-human-resigns
+ "C-c C-e" #'gomoku-emacs-plays
+
+ "<kp-enter>" #'gomoku-human-plays
+ "<insert>" #'gomoku-human-plays
+ "<down-mouse-1>" #'gomoku-click
+ "<drag-mouse-1>" #'gomoku-click
+ "<mouse-1>" #'gomoku-click
+ "<down-mouse-2>" #'gomoku-click
+ "<mouse-2>" #'gomoku-mouse-play
+ "<drag-mouse-2>" #'gomoku-mouse-play
+
+ "<remap> <backward-char>" #'gomoku-move-left
+ "<remap> <left-char>" #'gomoku-move-left
+ "<remap> <forward-char>" #'gomoku-move-right
+ "<remap> <right-char>" #'gomoku-move-right
+ "<remap> <previous-line>" #'gomoku-move-up
+ "<remap> <next-line>" #'gomoku-move-down
+ "<remap> <move-beginning-of-line>" #'gomoku-beginning-of-line
+ "<remap> <move-end-of-line>" #'gomoku-end-of-line
+ "<remap> <undo>" #'gomoku-human-takes-back
+ "<remap> <advertised-undo>" #'gomoku-human-takes-back)
(defvar gomoku-emacs-won ()
diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el
index df2b6fc867a..6091016b7c3 100644
--- a/lisp/play/mpuz.el
+++ b/lisp/play/mpuz.el
@@ -76,17 +76,12 @@ The value t means never ding, and `error' means only ding on wrong input."
"Hook to run upon entry to mpuz."
:type 'hook)
-(defvar mpuz-mode-map
- (let ((map (make-sparse-keymap)))
- (mapc (lambda (ch)
- (define-key map (char-to-string ch) 'mpuz-try-letter))
- "abcdefghijABCDEFGHIJ")
- (define-key map "\C-g" 'mpuz-offer-abort)
- (define-key map "?" 'describe-mode)
- map)
- "Local keymap to use in Mult Puzzle.")
-
-
+(defvar-keymap mpuz-mode-map
+ :doc "Local keymap to use in Mult Puzzle."
+ "C-g" #'mpuz-offer-abort
+ "?" #'describe-mode)
+(dolist (ch (mapcar #'char-to-string "abcdefghijABCDEFGHIJ"))
+ (keymap-set mpuz-mode-map ch #'mpuz-try-letter))
(define-derived-mode mpuz-mode fundamental-mode "Mult Puzzle"
:interactive nil
diff --git a/lisp/play/pong.el b/lisp/play/pong.el
index b8545dfa82f..f1426d8f0fa 100644
--- a/lisp/play/pong.el
+++ b/lisp/play/pong.el
@@ -173,23 +173,23 @@
;;; Initialize maps
-(defvar pong-mode-map
- (let ((map (make-sparse-keymap 'pong-mode-map)))
- (define-key map [left] 'pong-move-left)
- (define-key map [right] 'pong-move-right)
- (define-key map [up] 'pong-move-up)
- (define-key map [down] 'pong-move-down)
- (define-key map pong-left-key 'pong-move-left)
- (define-key map pong-right-key 'pong-move-right)
- (define-key map pong-up-key 'pong-move-up)
- (define-key map pong-down-key 'pong-move-down)
- (define-key map pong-quit-key 'pong-quit)
- (define-key map pong-pause-key 'pong-pause)
- map)
- "Modemap for pong-mode.")
-
-(defvar pong-null-map
- (make-sparse-keymap 'pong-null-map) "Null map for pong-mode.")
+(defvar-keymap pong-mode-map
+ :doc "Modemap for pong-mode."
+ :name 'pong-mode-map
+ "<left>" #'pong-move-left
+ "<right>" #'pong-move-right
+ "<up>" #'pong-move-up
+ "<down>" #'pong-move-down
+ pong-left-key #'pong-move-left
+ pong-right-key #'pong-move-right
+ pong-up-key #'pong-move-up
+ pong-down-key #'pong-move-down
+ pong-quit-key #'pong-quit
+ pong-pause-key #'pong-pause)
+
+(defvar-keymap pong-null-map
+ :doc "Null map for pong-mode."
+ :name 'pong-null-map)
diff --git a/lisp/play/solitaire.el b/lisp/play/solitaire.el
index bc1a0e44cbf..19d7ba51bc2 100644
--- a/lisp/play/solitaire.el
+++ b/lisp/play/solitaire.el
@@ -40,48 +40,46 @@
"Hook to run upon entry to Solitaire."
:type 'hook)
-(defvar solitaire-mode-map
- (let ((map (make-sparse-keymap)))
- (set-keymap-parent map special-mode-map)
-
- (define-key map "\C-f" 'solitaire-right)
- (define-key map "\C-b" 'solitaire-left)
- (define-key map "\C-p" 'solitaire-up)
- (define-key map "\C-n" 'solitaire-down)
- (define-key map "\r" 'solitaire-move)
- (define-key map [remap undo] 'solitaire-undo)
- (define-key map " " 'solitaire-do-check)
-
- (define-key map [right] 'solitaire-right)
- (define-key map [left] 'solitaire-left)
- (define-key map [up] 'solitaire-up)
- (define-key map [down] 'solitaire-down)
-
- (define-key map [S-right] 'solitaire-move-right)
- (define-key map [S-left] 'solitaire-move-left)
- (define-key map [S-up] 'solitaire-move-up)
- (define-key map [S-down] 'solitaire-move-down)
-
- (define-key map [kp-6] 'solitaire-right)
- (define-key map [kp-4] 'solitaire-left)
- (define-key map [kp-8] 'solitaire-up)
- (define-key map [kp-2] 'solitaire-down)
- (define-key map [kp-5] 'solitaire-center-point)
-
- (define-key map [S-kp-6] 'solitaire-move-right)
- (define-key map [S-kp-4] 'solitaire-move-left)
- (define-key map [S-kp-8] 'solitaire-move-up)
- (define-key map [S-kp-2] 'solitaire-move-down)
-
- (define-key map [kp-enter] 'solitaire-move)
- (define-key map [kp-0] 'solitaire-undo)
-
- ;; spoil it with s ;)
- (define-key map [?s] 'solitaire-solve)
-
- ;; (define-key map [kp-0] 'solitaire-hint) - Not yet provided ;)
- map)
- "Keymap for playing Solitaire.")
+(defvar-keymap solitaire-mode-map
+ :doc "Keymap for playing Solitaire."
+ :parent special-mode-map
+ "C-f" #'solitaire-right
+ "C-b" #'solitaire-left
+ "C-p" #'solitaire-up
+ "C-n" #'solitaire-down
+ "RET" #'solitaire-move
+ "SPC" #'solitaire-do-check
+
+ "<right>" #'solitaire-right
+ "<left>" #'solitaire-left
+ "<up>" #'solitaire-up
+ "<down>" #'solitaire-down
+
+ "S-<right>" #'solitaire-move-right
+ "S-<left>" #'solitaire-move-left
+ "S-<up>" #'solitaire-move-up
+ "S-<down>" #'solitaire-move-down
+
+ "<kp-6>" #'solitaire-right
+ "<kp-4>" #'solitaire-left
+ "<kp-8>" #'solitaire-up
+ "<kp-2>" #'solitaire-down
+ "<kp-5>" #'solitaire-center-point
+
+ "S-<kp-6>" #'solitaire-move-right
+ "S-<kp-4>" #'solitaire-move-left
+ "S-<kp-8>" #'solitaire-move-up
+ "S-<kp-2>" #'solitaire-move-down
+
+ "<kp-enter>" #'solitaire-move
+ "<kp-0>" #'solitaire-undo
+ "<remap> <undo>" #'solitaire-undo
+
+ ;; spoil it with s ;)
+ "s" #'solitaire-solve
+
+ ;; "[kp-0]" #'solitaire-hint - Not yet provided ;)
+ )
;; Solitaire mode is suitable only for specially formatted data.
(put 'solitaire-mode 'mode-class 'special)