Mercurial > emacs
comparison lisp/play/gomoku.el @ 39886:e1334fb129a2
(gomoku-mode): Use define-derived-mode.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sat, 13 Oct 2001 18:28:11 +0000 |
parents | a4570786d40d |
children | 98e8ee29a39c |
comparison
equal
deleted
inserted
replaced
39885:91b2bb6856b0 | 39886:e1334fb129a2 |
---|---|
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> |
7 ;; Keywords: games | 7 ;; Keywords: games |
8 | 8 |
166 | 166 |
167 (put 'gomoku-mode 'front-sticky | 167 (put 'gomoku-mode 'front-sticky |
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 |
175 marks horizontally, vertically or in diagonal. | 175 marks horizontally, vertically or in diagonal. |
176 | 176 |
178 | 178 |
179 Other useful commands: | 179 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. |
195 ;;; | 190 ;;; |
196 | 191 |