GNU bug report logs - #12771
24.2.50; Gomoku displays statistics in other buffers

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Wed, 31 Oct 2012 11:29:02 UTC

Severity: normal

Found in version 24.2.50

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12771 in the body.
You can then email your comments to 12771 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12771; Package emacs. (Wed, 31 Oct 2012 11:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stephen Berman <stephen.berman <at> gmx.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 31 Oct 2012 11:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2.50; Gomoku displays statistics in other buffers
Date: Wed, 31 Oct 2012 12:23:41 +0100
0. emacs -Q
1. M-x gomoku
2. Answer the question to start playing, or type C-g.
3. C-x k to kill the *Gomoku* buffer.
   => Now the current buffer is *scratch*; note the mode line text:
   " U:**-  *scratch*      All L5     (Lisp Interaction) "
4. M-x gomoku
   => The mode line of *scratch* now looks like this:
   " U:**-  *scratch*      All L5     (Lisp Interaction: Won 0, lost 0) "

As a result of killing the *Gomoku* buffer in step 3, the gomoku command
in step 4 tests gomoku-game-in-progress, and because its value is still
t (since the game was not finished), gomoku-terminate-game is called,
which in turn calls gomoku-display-statistics, which changes the mode
line of the current buffer, which is still *scratch* here.  The patch
below prevents this by ensuring the mode line is only changed if the
*Gomoku* buffer is current.

In addition, the patch changes "Won" to "won", which I believe conforms
to standard practice in English for use of capitalization after a colon
(cf. http://en.wikipedia.org/wiki/Colon_%28punctuation%29) and looks
better to me.  (However, the patch doesn't change the use of
mode-line-process for displaying the statistics, despite the comment
acknowledging that this is not clean.)


In GNU Emacs 24.2.50.1 (x86_64-suse-linux-gnu, GTK+ Version 3.4.4)
 of 2012-10-27 on rosalinde
Bzr revision: 110689 eliz <at> gnu.org-20121027112126-wznlfl8la6gwukh6
Windowing system distributor `The X.Org Foundation', version 11.0.11203000
System Description:	openSUSE 12.2 (x86_64)


2012-10-31  Stephen Berman  <stephen.berman <at> gmx.net>

	* play/gomoku.el (gomoku-display-statistics): Update mode line
	only when Gomoku buffer is current.  Don't capitalize "won", to
	conform to standard practice. (Bug#xxxxxx)

=== modified file 'lisp/play/gomoku.el'
--- lisp/play/gomoku.el	2012-09-01 01:04:26 +0000
+++ lisp/play/gomoku.el	2012-10-31 10:25:10 +0000
@@ -1054,16 +1054,18 @@
 
 (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 when Gomoku buffer is current (bug#xxxxxx).
+  (when (string= (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."





Reply sent to Chong Yidong <cyd <at> gnu.org>:
You have taken responsibility. (Thu, 01 Nov 2012 02:29:01 GMT) Full text and rfc822 format available.

Notification sent to Stephen Berman <stephen.berman <at> gmx.net>:
bug acknowledged by developer. (Thu, 01 Nov 2012 02:29:01 GMT) Full text and rfc822 format available.

Message #10 received at 12771-done <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 12771-done <at> debbugs.gnu.org
Subject: Re: bug#12771: 24.2.50; Gomoku displays statistics in other buffers
Date: Thu, 01 Nov 2012 10:25:50 +0800
Stephen Berman <stephen.berman <at> gmx.net> writes:

> As a result of killing the *Gomoku* buffer in step 3, the gomoku command
> in step 4 tests gomoku-game-in-progress, and because its value is still
> t (since the game was not finished), gomoku-terminate-game is called,
> which in turn calls gomoku-display-statistics, which changes the mode
> line of the current buffer, which is still *scratch* here.  The patch
> below prevents this by ensuring the mode line is only changed if the
> *Gomoku* buffer is current.

Committed, thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Nov 2012 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 176 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.