Mercurial > emacs
comparison lisp/play/mpuz.el @ 1217:d0b19afef0ae
Fix setup of mpuz-read-map not to depend on keymap format.
(mpuz): Renamed from mult-puzzle. Make it autoload.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 26 Sep 1992 21:27:08 +0000 |
parents | c8798ebd7d95 |
children | f287613dfc28 |
comparison
equal
deleted
inserted
replaced
1216:6a8704922fe8 | 1217:d0b19afef0ae |
---|---|
74 (define-key mpuz-mode-map "\C-g" 'mpuz-offer-abort) | 74 (define-key mpuz-mode-map "\C-g" 'mpuz-offer-abort) |
75 (define-key mpuz-mode-map "?" 'describe-mode)) | 75 (define-key mpuz-mode-map "?" 'describe-mode)) |
76 | 76 |
77 (if mpuz-read-map nil | 77 (if mpuz-read-map nil |
78 (setq mpuz-read-map (make-keymap)) | 78 (setq mpuz-read-map (make-keymap)) |
79 (fillarray mpuz-read-map 'exit-minibuffer)) | 79 (let ((i 0)) |
80 (while (< i (length mpuz-read-map)) | |
81 (define-key mpuz-read-map (char-to-string i) 'exit-minibuffer) | |
82 (setq i (1+ i))))) | |
80 | 83 |
81 (defun mpuz-mode () | 84 (defun mpuz-mode () |
82 "Multiplication puzzle with GNU Emacs. | 85 "Multiplication puzzle mode. |
83 | 86 |
84 You have to guess which letters stand for which digits in the | 87 You have to guess which letters stand for which digits in the |
85 multiplication displayed inside the *Mult Puzzle* buffer. | 88 multiplication displayed inside the `*Mult Puzzle*' buffer. |
86 | 89 |
87 You may enter a proposal (e.g. A=3) by hitting first the letter A, | 90 You may enter a guess for a letter's value by typing first the letter, |
88 then the digit 3, on your keyboard. | 91 then the digit. Thus, to guess that A=3, type A 3. |
89 | 92 |
90 At any time you may leave the game to do other editing work. :-) | 93 To leave the game to do other editing work, just switch buffers. |
91 Then you may resume the game with M-x mult-puzzle. | 94 Then you may resume the game with M-x mpuz. |
92 You may abort a game by hitting \\[keyboard-quit]." | 95 You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]." |
93 (interactive) | 96 (interactive) |
94 (setq major-mode 'mpuz-mode | 97 (setq major-mode 'mpuz-mode |
95 mode-name "Mult Puzzle") | 98 mode-name "Mult Puzzle") |
96 (use-local-map mpuz-mode-map) | 99 (use-local-map mpuz-mode-map) |
97 (run-hooks 'mpuz-mode-hook)) | 100 (run-hooks 'mpuz-mode-hook)) |
334 "Ask if user wants to start a new puzzle." | 337 "Ask if user wants to start a new puzzle." |
335 (if (y-or-n-p "Start a new game ") | 338 (if (y-or-n-p "Start a new game ") |
336 (mpuz-start-new-game) | 339 (mpuz-start-new-game) |
337 (message "OK. I won't."))) | 340 (message "OK. I won't."))) |
338 | 341 |
339 (defun mult-puzzle () | 342 ;;;###autoload |
343 (defun mpuz () | |
340 "Multiplication puzzle with GNU Emacs." | 344 "Multiplication puzzle with GNU Emacs." |
341 ;; Main entry point | 345 ;; Main entry point |
342 (interactive) | 346 (interactive) |
343 (mpuz-switch-to-window) | 347 (mpuz-switch-to-window) |
344 (if mpuz-in-progress | 348 (if mpuz-in-progress |