192 |
;; allow View Mode to be activated in its buffer. |
;; allow View Mode to be activated in its buffer. |
193 |
(put 'gomoku-mode 'mode-class 'special) |
(put 'gomoku-mode 'mode-class 'special) |
194 |
|
|
195 |
(define-derived-mode gomoku-mode nil "Gomoku" |
(defun gomoku-mode () |
196 |
"Major mode for playing Gomoku against Emacs. |
"Major mode for playing Gomoku against Emacs. |
197 |
You and Emacs play in turn by marking a free square. You mark it with X |
You and Emacs play in turn by marking a free square. You mark it with X |
198 |
and Emacs marks it with O. The winner is the first to get five contiguous |
and Emacs marks it with O. The winner is the first to get five contiguous |
204 |
\\{gomoku-mode-map} |
\\{gomoku-mode-map} |
205 |
Entry to this mode calls the value of `gomoku-mode-hook' if that value |
Entry to this mode calls the value of `gomoku-mode-hook' if that value |
206 |
is non-nil. One interesting value is `turn-on-font-lock'." |
is non-nil. One interesting value is `turn-on-font-lock'." |
207 |
|
(interactive) |
208 |
|
(setq major-mode 'gomoku-mode |
209 |
|
mode-name "Gomoku") |
210 |
(gomoku-display-statistics) |
(gomoku-display-statistics) |
211 |
(set (make-local-variable 'font-lock-defaults) |
(use-local-map gomoku-mode-map) |
212 |
'(gomoku-font-lock-keywords t)) |
(make-local-variable 'font-lock-defaults) |
213 |
(toggle-read-only t)) |
(setq font-lock-defaults '(gomoku-font-lock-keywords t)) |
214 |
|
(toggle-read-only t) |
215 |
|
(run-hooks 'gomoku-mode-hook)) |
216 |
|
|
217 |
;;; |
;;; |
218 |
;;; THE BOARD. |
;;; THE BOARD. |