From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#12771: 24.2.50; Gomoku displays statistics in other buffers Date: Wed, 31 Oct 2012 12:23:41 +0100 Message-ID: <87hapalwaq.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1351682811 10776 80.91.229.3 (31 Oct 2012 11:26:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 31 Oct 2012 11:26:51 +0000 (UTC) To: 12771@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 31 12:27:00 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TTWRm-0003QD-2L for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Oct 2012 12:26:58 +0100 Original-Received: from localhost ([::1]:58903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTWRd-0005Kb-KG for geb-bug-gnu-emacs@m.gmane.org; Wed, 31 Oct 2012 07:26:49 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTWRL-0004Vp-Um for bug-gnu-emacs@gnu.org; Wed, 31 Oct 2012 07:26:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTWRF-0005Ny-VH for bug-gnu-emacs@gnu.org; Wed, 31 Oct 2012 07:26:31 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTWRF-0005No-RG for bug-gnu-emacs@gnu.org; Wed, 31 Oct 2012 07:26:25 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TTWTm-0006Xj-Be for bug-gnu-emacs@gnu.org; Wed, 31 Oct 2012 07:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 31 Oct 2012 11:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12771 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135168291125091 (code B ref -1); Wed, 31 Oct 2012 11:29:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 Oct 2012 11:28:31 +0000 Original-Received: from localhost ([127.0.0.1]:40881 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TTWTH-0006Wd-BP for submit@debbugs.gnu.org; Wed, 31 Oct 2012 07:28:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54265) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TTWTF-0006WW-3p for submit@debbugs.gnu.org; Wed, 31 Oct 2012 07:28:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTWQc-0004zR-UK for submit@debbugs.gnu.org; Wed, 31 Oct 2012 07:25:52 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:37326) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTWQc-0004wu-Qs for submit@debbugs.gnu.org; Wed, 31 Oct 2012 07:25:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTWOq-0001Zq-JB for bug-gnu-emacs@gnu.org; Wed, 31 Oct 2012 07:24:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTWOf-0003rx-RV for bug-gnu-emacs@gnu.org; Wed, 31 Oct 2012 07:23:56 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:52876) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TTWOf-0003qH-GF for bug-gnu-emacs@gnu.org; Wed, 31 Oct 2012 07:23:45 -0400 Original-Received: (qmail invoked by alias); 31 Oct 2012 11:23:42 -0000 Original-Received: from i59F5416E.versanet.de (EHLO rosalinde.fritz.box) [89.245.65.110] by mail.gmx.net (mp069) with SMTP; 31 Oct 2012 12:23:42 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX19b+UoNte1bIU/nZJ//anoJCUfEKQvrEZxKsLTZ0I aZ/MBIEw9NJibt User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:66270 Archived-At: 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@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 * 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."