aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2003-04-12 15:51:57 +0000
committerGlenn Morris2003-04-12 15:51:57 +0000
commit428d45d25510bbf44fca48e934299202048d0ad9 (patch)
tree5e9ed2e6768d4be881de891094c25cd9927b4393
parentbe550ccc612bdfae9d976c1f0d81b41e0a5140d5 (diff)
downloademacs-428d45d25510bbf44fca48e934299202048d0ad9.tar.gz
emacs-428d45d25510bbf44fca48e934299202048d0ad9.zip
(gomoku-buffer-name): New constant.
(gomoku-mode): Doc fix. Add call to kill-all-local-variables, for global-font-lock-mode. (gomoku): Do not call gomoku-switch-to-window directly, else the player is asked the startup questions twice after a killed game. (gomoku-prompt-for-other-game): Throw an error if no new game, since otherwise answering no after a killed game has no effect. (gomoku-switch-to-window): Use gomoku-buffer-name.
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/play/gomoku.el33
2 files changed, 37 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3113adfc023..5b4616a27ee 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
12003-04-12 Glenn Morris <gmorris@ast.cam.ac.uk>
2
3 * play/gomoku.el (gomoku-buffer-name): New constant.
4 (gomoku-mode): Doc fix. Add call to kill-all-local-variables.
5 (gomoku): Do not call gomoku-switch-to-window directly.
6 (gomoku-prompt-for-other-game): Throw an error if no new game.
7 (gomoku-switch-to-window): Use gomoku-buffer-name.
8
9 * progmodes/f90.el (f90-abbrev-start): Only offer help if
10 abbrev-mode is active.
11
12 * progmodes/fortran.el (fortran-abbrev-start): Only offer help if
13 abbrev-mode is active.
14
12003-04-12 John Paul Wallington <jpw@gnu.org> 152003-04-12 John Paul Wallington <jpw@gnu.org>
2 16
3 * help-fns.el (help-add-fundoc-usage): Pass an empty string to 17 * help-fns.el (help-add-fundoc-usage): Pass an empty string to
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el
index c644672356a..7340f4d9d6b 100644
--- a/lisp/play/gomoku.el
+++ b/lisp/play/gomoku.el
@@ -84,6 +84,9 @@ One useful value to include is `turn-on-font-lock' to highlight the pieces."
84;;; CONSTANTS FOR BOARD 84;;; CONSTANTS FOR BOARD
85;;; 85;;;
86 86
87(defconst gomoku-buffer-name "*Gomoku*"
88 "Name of the Gomoku buffer.")
89
87;; You may change these values if you have a small screen or if the squares 90;; You may change these values if you have a small screen or if the squares
88;; look rectangular, but spacings SHOULD be at least 2 (MUST BE at least 1). 91;; look rectangular, but spacings SHOULD be at least 2 (MUST BE at least 1).
89 92
@@ -193,8 +196,9 @@ You play by moving the cursor over the square you choose and hitting \\[gomoku-h
193Other useful commands: 196Other useful commands:
194\\{gomoku-mode-map} 197\\{gomoku-mode-map}
195Entry to this mode calls the value of `gomoku-mode-hook' if that value 198Entry to this mode calls the value of `gomoku-mode-hook' if that value
196is non-nil. One interesting value is `turn-on-font-lock'." 199is non-nil."
197 (interactive) 200 (interactive)
201 (kill-all-local-variables)
198 (setq major-mode 'gomoku-mode 202 (setq major-mode 'gomoku-mode
199 mode-name "Gomoku") 203 mode-name "Gomoku")
200 (gomoku-display-statistics) 204 (gomoku-display-statistics)
@@ -747,7 +751,17 @@ Use \\[describe-mode] for more info."
747 (interactive (if current-prefix-arg 751 (interactive (if current-prefix-arg
748 (list (prefix-numeric-value current-prefix-arg) 752 (list (prefix-numeric-value current-prefix-arg)
749 (eval (read-minibuffer "Height: "))))) 753 (eval (read-minibuffer "Height: ")))))
750 (gomoku-switch-to-window) 754 ;; gomoku-switch-to-window, but without the potential call to gomoku
755 ;; from gomoku-prompt-for-other-game.
756 (if (get-buffer gomoku-buffer-name)
757 (switch-to-buffer gomoku-buffer-name)
758 (when gomoku-game-in-progress
759 (setq gomoku-emacs-is-computing nil)
760 (gomoku-terminate-game 'crash-game)
761 (sit-for 4)
762 (or (y-or-n-p "Another game ") (error "Chicken !")))
763 (switch-to-buffer gomoku-buffer-name)
764 (gomoku-mode))
751 (cond 765 (cond
752 (gomoku-emacs-is-computing 766 (gomoku-emacs-is-computing
753 (gomoku-crash-game)) 767 (gomoku-crash-game))
@@ -934,7 +948,7 @@ If the game is finished, this command requests for another game."
934 "Ask for another game, and start it." 948 "Ask for another game, and start it."
935 (if (y-or-n-p "Another game ") 949 (if (y-or-n-p "Another game ")
936 (gomoku gomoku-board-width gomoku-board-height) 950 (gomoku gomoku-board-width gomoku-board-height)
937 (message "Chicken !"))) 951 (error "Chicken !")))
938 952
939(defun gomoku-offer-a-draw () 953(defun gomoku-offer-a-draw ()
940 "Offer a draw and return t if Human accepted it." 954 "Offer a draw and return t if Human accepted it."
@@ -1067,13 +1081,12 @@ If the game is finished, this command requests for another game."
1067(defun gomoku-switch-to-window () 1081(defun gomoku-switch-to-window ()
1068 "Find or create the Gomoku buffer, and display it." 1082 "Find or create the Gomoku buffer, and display it."
1069 (interactive) 1083 (interactive)
1070 (let ((buff (get-buffer "*Gomoku*"))) 1084 (if (get-buffer gomoku-buffer-name) ; Buffer exists:
1071 (if buff ; Buffer exists: 1085 (switch-to-buffer gomoku-buffer-name) ; no problem.
1072 (switch-to-buffer buff) ; no problem. 1086 (if gomoku-game-in-progress
1073 (if gomoku-game-in-progress 1087 (gomoku-crash-game)) ; buffer has been killed or something
1074 (gomoku-crash-game)) ; buffer has been killed or something 1088 (switch-to-buffer gomoku-buffer-name) ; Anyway, start anew.
1075 (switch-to-buffer "*Gomoku*") ; Anyway, start anew. 1089 (gomoku-mode)))
1076 (gomoku-mode))))
1077 1090
1078;;; 1091;;;
1079;;; CROSSING WINNING QTUPLES. 1092;;; CROSSING WINNING QTUPLES.