diff options
Diffstat (limited to 'lisp/play')
| -rw-r--r-- | lisp/play/blackbox.el | 6 | ||||
| -rw-r--r-- | lisp/play/doctor.el | 17 | ||||
| -rw-r--r-- | lisp/play/dunnet.el | 22 | ||||
| -rw-r--r-- | lisp/play/gomoku.el | 18 | ||||
| -rw-r--r-- | lisp/play/mpuz.el | 24 |
5 files changed, 41 insertions, 46 deletions
diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el index 6fad15b8155..02f8cb5eeb0 100644 --- a/lisp/play/blackbox.el +++ b/lisp/play/blackbox.el | |||
| @@ -117,14 +117,14 @@ The usual mnemonic keys move the cursor around the box. | |||
| 117 | \\<blackbox-mode-map>\\[bb-bol] and \\[bb-eol] move to the beginning and end of line, respectively. | 117 | \\<blackbox-mode-map>\\[bb-bol] and \\[bb-eol] move to the beginning and end of line, respectively. |
| 118 | 118 | ||
| 119 | \\[bb-romp] -- send in a ray from point, or toggle a ball at point | 119 | \\[bb-romp] -- send in a ray from point, or toggle a ball at point |
| 120 | \\[bb-done] -- end game and get score | 120 | \\[bb-done] -- end game and get score" |
| 121 | " | ||
| 122 | (interactive) | 121 | (interactive) |
| 123 | (kill-all-local-variables) | 122 | (kill-all-local-variables) |
| 124 | (use-local-map blackbox-mode-map) | 123 | (use-local-map blackbox-mode-map) |
| 125 | (setq truncate-lines t) | 124 | (setq truncate-lines t) |
| 126 | (setq major-mode 'blackbox-mode) | 125 | (setq major-mode 'blackbox-mode) |
| 127 | (setq mode-name "Blackbox")) | 126 | (setq mode-name "Blackbox") |
| 127 | (run-mode-hooks 'blackbox-mode-hook)) | ||
| 128 | 128 | ||
| 129 | ;;;###autoload | 129 | ;;;###autoload |
| 130 | (defun blackbox (num) | 130 | (defun blackbox (num) |
diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el index 798abbc790a..7b81daa7782 100644 --- a/lisp/play/doctor.el +++ b/lisp/play/doctor.el | |||
| @@ -59,30 +59,21 @@ | |||
| 59 | (set what ww) | 59 | (set what ww) |
| 60 | first)) | 60 | first)) |
| 61 | 61 | ||
| 62 | (defvar doctor-mode-map nil) | 62 | (define-derived-mode doctor-mode text-mode "Doctor" |
| 63 | (if doctor-mode-map | ||
| 64 | nil | ||
| 65 | (setq doctor-mode-map (make-sparse-keymap)) | ||
| 66 | (define-key doctor-mode-map "\n" 'doctor-read-print) | ||
| 67 | (define-key doctor-mode-map "\r" 'doctor-ret-or-read)) | ||
| 68 | |||
| 69 | (defun doctor-mode () | ||
| 70 | "Major mode for running the Doctor (Eliza) program. | 63 | "Major mode for running the Doctor (Eliza) program. |
| 71 | Like Text mode with Auto Fill mode | 64 | Like Text mode with Auto Fill mode |
| 72 | except that RET when point is after a newline, or LFD at any time, | 65 | except that RET when point is after a newline, or LFD at any time, |
| 73 | reads the sentence before point, and prints the Doctor's answer." | 66 | reads the sentence before point, and prints the Doctor's answer." |
| 74 | (interactive) | ||
| 75 | (text-mode) | ||
| 76 | (make-doctor-variables) | 67 | (make-doctor-variables) |
| 77 | (use-local-map doctor-mode-map) | ||
| 78 | (setq major-mode 'doctor-mode) | ||
| 79 | (setq mode-name "Doctor") | ||
| 80 | (turn-on-auto-fill) | 68 | (turn-on-auto-fill) |
| 81 | (doctor-type '(i am the psychotherapist \. | 69 | (doctor-type '(i am the psychotherapist \. |
| 82 | (doc$ please) (doc$ describe) your (doc$ problems) \. | 70 | (doc$ please) (doc$ describe) your (doc$ problems) \. |
| 83 | each time you are finished talking, type \R\E\T twice \.)) | 71 | each time you are finished talking, type \R\E\T twice \.)) |
| 84 | (insert "\n")) | 72 | (insert "\n")) |
| 85 | 73 | ||
| 74 | (define-key doctor-mode-map "\n" 'doctor-read-print) | ||
| 75 | (define-key doctor-mode-map "\r" 'doctor-ret-or-read) | ||
| 76 | |||
| 86 | (defun make-doctor-variables () | 77 | (defun make-doctor-variables () |
| 87 | (make-local-variable 'typos) | 78 | (make-local-variable 'typos) |
| 88 | (setq typos | 79 | (setq typos |
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 50b8bce5f74..290ee6ebf5d 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el | |||
| @@ -53,15 +53,10 @@ | |||
| 53 | 53 | ||
| 54 | ;;;; Mode definitions for interactive mode | 54 | ;;;; Mode definitions for interactive mode |
| 55 | 55 | ||
| 56 | (defun dun-mode () | 56 | (define-derived-mode dun-mode text-mode "Dungeon" |
| 57 | "Major mode for running dunnet." | 57 | "Major mode for running dunnet." |
| 58 | (interactive) | ||
| 59 | (text-mode) | ||
| 60 | (make-local-variable 'scroll-step) | 58 | (make-local-variable 'scroll-step) |
| 61 | (setq scroll-step 2) | 59 | (setq scroll-step 2)) |
| 62 | (use-local-map dungeon-mode-map) | ||
| 63 | (setq major-mode 'dun-mode) | ||
| 64 | (setq mode-name "Dungeon")) | ||
| 65 | 60 | ||
| 66 | (defun dun-parse (arg) | 61 | (defun dun-parse (arg) |
| 67 | "Function called when return is pressed in interactive mode to parse line." | 62 | "Function called when return is pressed in interactive mode to parse line." |
| @@ -1366,9 +1361,8 @@ for a moment, then straighten yourself up. | |||
| 1366 | (setq dun-current-room 1) | 1361 | (setq dun-current-room 1) |
| 1367 | (setq dun-exitf nil) | 1362 | (setq dun-exitf nil) |
| 1368 | (setq dun-badcd nil) | 1363 | (setq dun-badcd nil) |
| 1369 | (defvar dungeon-mode-map nil) | 1364 | (define-obsolete-variable-alias 'dungeon-mode-map 'dun-mode-map "22.1") |
| 1370 | (setq dungeon-mode-map (make-sparse-keymap)) | 1365 | (define-key dun-mode-map "\r" 'dun-parse) |
| 1371 | (define-key dungeon-mode-map "\r" 'dun-parse) | ||
| 1372 | (defvar dungeon-batch-map (make-keymap)) | 1366 | (defvar dungeon-batch-map (make-keymap)) |
| 1373 | (if (string= (substring emacs-version 0 2) "18") | 1367 | (if (string= (substring emacs-version 0 2) "18") |
| 1374 | (let (n) | 1368 | (let (n) |
| @@ -2594,7 +2588,7 @@ treasures for points?" "4" "four") | |||
| 2594 | (if dun-logged-in | 2588 | (if dun-logged-in |
| 2595 | (progn | 2589 | (progn |
| 2596 | (setq dungeon-mode 'unix) | 2590 | (setq dungeon-mode 'unix) |
| 2597 | (define-key dungeon-mode-map "\r" 'dun-unix-parse) | 2591 | (define-key dun-mode-map "\r" 'dun-unix-parse) |
| 2598 | (dun-mprinc "$ ")))) | 2592 | (dun-mprinc "$ ")))) |
| 2599 | 2593 | ||
| 2600 | (defun dun-login () | 2594 | (defun dun-login () |
| @@ -2860,7 +2854,7 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") | |||
| 2860 | (defun dun-uexit (args) | 2854 | (defun dun-uexit (args) |
| 2861 | (setq dungeon-mode 'dungeon) | 2855 | (setq dungeon-mode 'dungeon) |
| 2862 | (dun-mprincl "\nYou step back from the console.") | 2856 | (dun-mprincl "\nYou step back from the console.") |
| 2863 | (define-key dungeon-mode-map "\r" 'dun-parse) | 2857 | (define-key dun-mode-map "\r" 'dun-parse) |
| 2864 | (if (not dun-batch-mode) | 2858 | (if (not dun-batch-mode) |
| 2865 | (dun-messages))) | 2859 | (dun-messages))) |
| 2866 | 2860 | ||
| @@ -3059,7 +3053,7 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") | |||
| 3059 | (defun dun-dos-interface () | 3053 | (defun dun-dos-interface () |
| 3060 | (dun-dos-boot-msg) | 3054 | (dun-dos-boot-msg) |
| 3061 | (setq dungeon-mode 'dos) | 3055 | (setq dungeon-mode 'dos) |
| 3062 | (define-key dungeon-mode-map "\r" 'dun-dos-parse) | 3056 | (define-key dun-mode-map "\r" 'dun-dos-parse) |
| 3063 | (dun-dos-prompt)) | 3057 | (dun-dos-prompt)) |
| 3064 | 3058 | ||
| 3065 | (defun dun-dos-type (args) | 3059 | (defun dun-dos-type (args) |
| @@ -3117,7 +3111,7 @@ File not found"))) | |||
| 3117 | (defun dun-dos-exit (args) | 3111 | (defun dun-dos-exit (args) |
| 3118 | (setq dungeon-mode 'dungeon) | 3112 | (setq dungeon-mode 'dungeon) |
| 3119 | (dun-mprincl "\nYou power down the machine and step back.") | 3113 | (dun-mprincl "\nYou power down the machine and step back.") |
| 3120 | (define-key dungeon-mode-map "\r" 'dun-parse) | 3114 | (define-key dun-mode-map "\r" 'dun-parse) |
| 3121 | (if (not dun-batch-mode) | 3115 | (if (not dun-batch-mode) |
| 3122 | (dun-messages))) | 3116 | (dun-messages))) |
| 3123 | 3117 | ||
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el index 69ec07496d5..611c095fbd1 100644 --- a/lisp/play/gomoku.el +++ b/lisp/play/gomoku.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; gomoku.el --- Gomoku game between you and Emacs | 1 | ;;; gomoku.el --- Gomoku game between you and Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1988, 1994, 1996, 2001, 2003 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1988, 1994, 1996, 2001, 2003, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Philippe Schnoebelen <phs@lsv.ens-cachan.fr> | 5 | ;; Author: Philippe Schnoebelen <phs@lsv.ens-cachan.fr> |
| 6 | ;; Maintainer: FSF | 6 | ;; Maintainer: FSF |
| @@ -160,22 +160,24 @@ One useful value to include is `turn-on-font-lock' to highlight the pieces." | |||
| 160 | (defvar gomoku-emacs-won () | 160 | (defvar gomoku-emacs-won () |
| 161 | "For making font-lock use the winner's face for the line.") | 161 | "For making font-lock use the winner's face for the line.") |
| 162 | 162 | ||
| 163 | (defface gomoku-font-lock-O-face | 163 | (defface gomoku-O |
| 164 | '((((class color)) (:foreground "red" :weight bold))) | 164 | '((((class color)) (:foreground "red" :weight bold))) |
| 165 | "Face to use for Emacs' O." | 165 | "Face to use for Emacs' O." |
| 166 | :group 'gomoku) | 166 | :group 'gomoku) |
| 167 | ;; backward-compatibility alias | ||
| 168 | (put 'gomoku-font-lock-O-face 'face-alias 'gomoku-O) | ||
| 167 | 169 | ||
| 168 | (defface gomoku-font-lock-X-face | 170 | (defface gomoku-X |
| 169 | '((((class color)) (:foreground "green" :weight bold))) | 171 | '((((class color)) (:foreground "green" :weight bold))) |
| 170 | "Face to use for your X." | 172 | "Face to use for your X." |
| 171 | :group 'gomoku) | 173 | :group 'gomoku) |
| 174 | ;; backward-compatibility alias | ||
| 175 | (put 'gomoku-font-lock-X-face 'face-alias 'gomoku-X) | ||
| 172 | 176 | ||
| 173 | (defvar gomoku-font-lock-keywords | 177 | (defvar gomoku-font-lock-keywords |
| 174 | '(("O" . 'gomoku-font-lock-O-face) | 178 | '(("O" . 'gomoku-O) |
| 175 | ("X" . 'gomoku-font-lock-X-face) | 179 | ("X" . 'gomoku-X) |
| 176 | ("[-|/\\]" 0 (if gomoku-emacs-won | 180 | ("[-|/\\]" 0 (if gomoku-emacs-won 'gomoku-O 'gomoku-X))) |
| 177 | 'gomoku-font-lock-O-face | ||
| 178 | 'gomoku-font-lock-X-face))) | ||
| 179 | "*Font lock rules for Gomoku.") | 181 | "*Font lock rules for Gomoku.") |
| 180 | 182 | ||
| 181 | (put 'gomoku-mode 'front-sticky | 183 | (put 'gomoku-mode 'front-sticky |
diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el index 849e87a28b0..e354da6a04b 100644 --- a/lisp/play/mpuz.el +++ b/lisp/play/mpuz.el | |||
| @@ -57,28 +57,36 @@ t means never ding, and `error' means only ding on wrong input." | |||
| 57 | :type 'boolean | 57 | :type 'boolean |
| 58 | :group 'mpuz) | 58 | :group 'mpuz) |
| 59 | 59 | ||
| 60 | (defface mpuz-unsolved-face | 60 | (defface mpuz-unsolved |
| 61 | '((((class color)) (:foreground "red1" :bold t)) | 61 | '((((class color)) (:foreground "red1" :bold t)) |
| 62 | (t (:bold t))) | 62 | (t (:bold t))) |
| 63 | "*Face to use for letters to be solved." | 63 | "*Face to use for letters to be solved." |
| 64 | :group 'mpuz) | 64 | :group 'mpuz) |
| 65 | ;; backward-compatibility alias | ||
| 66 | (put 'mpuz-unsolved-face 'face-alias 'mpuz-unsolved) | ||
| 65 | 67 | ||
| 66 | (defface mpuz-solved-face | 68 | (defface mpuz-solved |
| 67 | '((((class color)) (:foreground "green1" :bold t)) | 69 | '((((class color)) (:foreground "green1" :bold t)) |
| 68 | (t (:bold t))) | 70 | (t (:bold t))) |
| 69 | "*Face to use for solved digits." | 71 | "*Face to use for solved digits." |
| 70 | :group 'mpuz) | 72 | :group 'mpuz) |
| 73 | ;; backward-compatibility alias | ||
| 74 | (put 'mpuz-solved-face 'face-alias 'mpuz-solved) | ||
| 71 | 75 | ||
| 72 | (defface mpuz-trivial-face | 76 | (defface mpuz-trivial |
| 73 | '((((class color)) (:foreground "blue" :bold t)) | 77 | '((((class color)) (:foreground "blue" :bold t)) |
| 74 | (t (:bold t))) | 78 | (t (:bold t))) |
| 75 | "*Face to use for trivial digits solved for you." | 79 | "*Face to use for trivial digits solved for you." |
| 76 | :group 'mpuz) | 80 | :group 'mpuz) |
| 81 | ;; backward-compatibility alias | ||
| 82 | (put 'mpuz-trivial-face 'face-alias 'mpuz-trivial) | ||
| 77 | 83 | ||
| 78 | (defface mpuz-text-face | 84 | (defface mpuz-text |
| 79 | '((t (:inherit variable-pitch))) | 85 | '((t (:inherit variable-pitch))) |
| 80 | "*Face to use for text on right." | 86 | "*Face to use for text on right." |
| 81 | :group 'mpuz) | 87 | :group 'mpuz) |
| 88 | ;; backward-compatibility alias | ||
| 89 | (put 'mpuz-text-face 'face-alias 'mpuz-text) | ||
| 82 | 90 | ||
| 83 | 91 | ||
| 84 | ;; Mpuz mode and keymaps | 92 | ;; Mpuz mode and keymaps |
| @@ -296,7 +304,7 @@ You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]." | |||
| 296 | (defun mpuz-create-buffer () | 304 | (defun mpuz-create-buffer () |
| 297 | "Create (or recreate) the puzzle buffer. Return it." | 305 | "Create (or recreate) the puzzle buffer. Return it." |
| 298 | (let ((buf (get-buffer-create "*Mult Puzzle*")) | 306 | (let ((buf (get-buffer-create "*Mult Puzzle*")) |
| 299 | (face '(face mpuz-text-face)) | 307 | (face '(face mpuz-text)) |
| 300 | buffer-read-only) | 308 | buffer-read-only) |
| 301 | (save-excursion | 309 | (save-excursion |
| 302 | (set-buffer buf) | 310 | (set-buffer buf) |
| @@ -347,9 +355,9 @@ You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]." | |||
| 347 | (+ digit ?0) | 355 | (+ digit ?0) |
| 348 | (+ (mpuz-to-letter digit) ?A))) | 356 | (+ (mpuz-to-letter digit) ?A))) |
| 349 | (face `(face | 357 | (face `(face |
| 350 | ,(cond ((aref mpuz-trivial-digits digit) 'mpuz-trivial-face) | 358 | ,(cond ((aref mpuz-trivial-digits digit) 'mpuz-trivial) |
| 351 | ((aref mpuz-found-digits digit) 'mpuz-solved-face) | 359 | ((aref mpuz-found-digits digit) 'mpuz-solved) |
| 352 | ('mpuz-unsolved-face)))) | 360 | ('mpuz-unsolved)))) |
| 353 | buffer-read-only) | 361 | buffer-read-only) |
| 354 | (mapc (lambda (square) | 362 | (mapc (lambda (square) |
| 355 | (goto-line (car square)) ; line before column! | 363 | (goto-line (car square)) ; line before column! |