]> code.delx.au - gnu-emacs/blobdiff - lisp/play/gomoku.el
Remove references to universal-argument-num-events.
[gnu-emacs] / lisp / play / gomoku.el
index 6d73e2ccb65daa035bf51a814798a6be51b3e6aa..609585c95222752dea1c59759b405577ca7ee754 100644 (file)
@@ -1,6 +1,7 @@
 ;;; gomoku.el --- Gomoku game between you and Emacs
 
-;; Copyright (C) 1988, 1994, 1996, 2001-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 1996, 2001-2013 Free Software Foundation,
+;; Inc.
 
 ;; Author: Philippe Schnoebelen <phs@lsv.ens-cachan.fr>
 ;; Maintainer: FSF
@@ -947,13 +948,13 @@ If the game is finished, this command requests for another game."
 
 (defun gomoku-max-width ()
   "Largest possible board width for the current window."
-  (1+ (/ (- (window-width (selected-window))
+  (1+ (/ (- (window-width)
            gomoku-x-offset gomoku-x-offset 1)
         gomoku-square-width)))
 
 (defun gomoku-max-height ()
   "Largest possible board height for the current window."
-  (1+ (/ (- (window-height (selected-window))
+  (1+ (/ (- (window-height)
            gomoku-y-offset gomoku-y-offset 2)
         ;; 2 instead of 1 because WINDOW-HEIGHT includes the mode line !
         gomoku-square-height)))
@@ -1054,16 +1055,18 @@ If the game is finished, this command requests for another game."
 
 (defun gomoku-display-statistics ()
   "Obnoxiously display some statistics about previous games in mode line."
-  ;; We store this string in the mode-line-process local variable.
-  ;; This is certainly not the cleanest way out ...
-  (setq mode-line-process
-       (format ": Won %d, lost %d%s"
-               gomoku-number-of-human-wins
-               gomoku-number-of-emacs-wins
-               (if (zerop gomoku-number-of-draws)
-                   ""
-                 (format ", drew %d" gomoku-number-of-draws))))
-  (force-mode-line-update))
+  ;; Update mode line only if Gomoku buffer is current (Bug#12771).
+  (when (string-equal (buffer-name) gomoku-buffer-name)
+    ;; We store this string in the mode-line-process local variable.
+    ;; This is certainly not the cleanest way out ...
+    (setq mode-line-process
+         (format ": won %d, lost %d%s"
+                 gomoku-number-of-human-wins
+                 gomoku-number-of-emacs-wins
+                 (if (zerop gomoku-number-of-draws)
+                     ""
+                   (format ", drew %d" gomoku-number-of-draws))))
+    (force-mode-line-update)))
 
 (defun gomoku-switch-to-window ()
   "Find or create the Gomoku buffer, and display it."
@@ -1197,8 +1200,6 @@ If the game is finished, this command requests for another game."
   (move-to-column (+ gomoku-x-offset
                     (* gomoku-square-width (1- gomoku-board-width)))))
 
-(random t)
-
 (provide 'gomoku)
 
 ;;; gomoku.el ends here