diff options
| author | Stefan Monnier | 2001-10-13 18:28:11 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-10-13 18:28:11 +0000 |
| commit | 3ed03518354e263e5406590a303bedac230155fc (patch) | |
| tree | 72dd254c6ef59ec998f100fb94ec491c4609457f | |
| parent | bd161121f8e31abd567f89cb1c792882e8329d62 (diff) | |
| download | emacs-3ed03518354e263e5406590a303bedac230155fc.tar.gz emacs-3ed03518354e263e5406590a303bedac230155fc.zip | |
(gomoku-mode): Use define-derived-mode.
| -rw-r--r-- | lisp/play/gomoku.el | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el index f08d934459a..67e193ae416 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 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1988, 1994, 1996, 2001 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 | ;; Adapted-By: ESR, Daniel Pfeiffer <occitan@esperanto.org> | 6 | ;; Adapted-By: ESR, Daniel Pfeiffer <occitan@esperanto.org> |
| @@ -168,7 +168,7 @@ One useful value to include is `turn-on-font-lock' to highlight the pieces." | |||
| 168 | (put 'gomoku-mode 'rear-nonsticky '(intangible))) | 168 | (put 'gomoku-mode 'rear-nonsticky '(intangible))) |
| 169 | (put 'gomoku-mode 'intangible 1) | 169 | (put 'gomoku-mode 'intangible 1) |
| 170 | 170 | ||
| 171 | (defun gomoku-mode () | 171 | (define-derived-mode gomoku-mode nil "Gomoku" |
| 172 | "Major mode for playing Gomoku against Emacs. | 172 | "Major mode for playing Gomoku against Emacs. |
| 173 | You and Emacs play in turn by marking a free square. You mark it with X | 173 | You and Emacs play in turn by marking a free square. You mark it with X |
| 174 | and Emacs marks it with O. The winner is the first to get five contiguous | 174 | and Emacs marks it with O. The winner is the first to get five contiguous |
| @@ -180,15 +180,10 @@ Other useful commands: | |||
| 180 | \\{gomoku-mode-map} | 180 | \\{gomoku-mode-map} |
| 181 | Entry to this mode calls the value of `gomoku-mode-hook' if that value | 181 | Entry to this mode calls the value of `gomoku-mode-hook' if that value |
| 182 | is non-nil. One interesting value is `turn-on-font-lock'." | 182 | is non-nil. One interesting value is `turn-on-font-lock'." |
| 183 | (interactive) | ||
| 184 | (setq major-mode 'gomoku-mode | ||
| 185 | mode-name "Gomoku") | ||
| 186 | (gomoku-display-statistics) | 183 | (gomoku-display-statistics) |
| 187 | (use-local-map gomoku-mode-map) | 184 | (set (make-local-variable 'font-lock-defaults) |
| 188 | (make-local-variable 'font-lock-defaults) | 185 | '(gomoku-font-lock-keywords t)) |
| 189 | (setq font-lock-defaults '(gomoku-font-lock-keywords t)) | 186 | (toggle-read-only t)) |
| 190 | (toggle-read-only t) | ||
| 191 | (run-hooks 'gomoku-mode-hook)) | ||
| 192 | 187 | ||
| 193 | ;;; | 188 | ;;; |
| 194 | ;;; THE BOARD. | 189 | ;;; THE BOARD. |