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#12779: 24.2.50; Gamegrid signals an error when score is too low Date: Thu, 01 Nov 2012 22:03:40 +0100 Message-ID: <87txt9828j.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1351803870 31622 80.91.229.3 (1 Nov 2012 21:04:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 1 Nov 2012 21:04:30 +0000 (UTC) To: 12779@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Nov 01 22:04:38 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 1TU1wF-0005Te-TP for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Nov 2012 22:04:32 +0100 Original-Received: from localhost ([::1]:34313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU1w7-0005RR-BD for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Nov 2012 17:04:23 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU1w3-0005RF-Dv for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:04:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU1w2-0000Qj-8J for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:04:19 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33290) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU1w2-0000Qf-4s for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:04:18 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TU1yg-0005sj-Ft for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:07: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: Thu, 01 Nov 2012 21:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12779 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.135180399522574 (code B ref -1); Thu, 01 Nov 2012 21:07:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Nov 2012 21:06:35 +0000 Original-Received: from localhost ([127.0.0.1]:43540 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TU1yF-0005s3-95 for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:06:35 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47886) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TU1yC-0005rv-Ql for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:06:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU1vX-0008SU-7j for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:03:48 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:43886) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU1vX-0008SO-4m for submit@debbugs.gnu.org; Thu, 01 Nov 2012 17:03:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TU1vV-0005QB-P0 for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:03:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TU1vU-0008R5-Fy for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:03:45 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.22]:58850) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TU1vU-0008Qx-6L for bug-gnu-emacs@gnu.org; Thu, 01 Nov 2012 17:03:44 -0400 Original-Received: (qmail invoked by alias); 01 Nov 2012 21:03:41 -0000 Original-Received: from i59F54801.versanet.de (EHLO rosalinde.fritz.box) [89.245.72.1] by mail.gmx.net (mp004) with SMTP; 01 Nov 2012 22:03:41 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1+LLXpLMC2LKchBhMWAbsPamFR7bxXygVovsOZNzh 1XYDKGvMnIKAZd 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: GNU/Linux 3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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.x 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:66324 Archived-At: --=-=-= Content-Type: text/plain If you play a game that keeps a list of top scores, such as Bubbles, and that list has reached the maximum number of entries (set in lib-src/update-game-score.c at 200 entries), and the game ends with a score too low to make the list, you get a message like this: Search failed: "601 steve Stephen Berman Thu Nov 1 18:10:50 2012" To reproduce: 0. emacs -Q 1. Create a score file with 200 entries, each with improbably high scores; e.g. for the default Bubbles game, create ~/.emacs.d/games/bubbles-default-2-10-10-scores with 200 lines like this: 10000 Thu Nov 1 20:58:35 2012 Stephen Berman (This assumes the score file is kept in user-emacs-directory, but AFAICS the problem should also occur with a non-nil shared-game-score-directory.) 2. M-x bubbles, play till the games is over (don't play well enough to get a top score!). => the error is signalled. The reason is that gamegrid-add-score-with-update-game-score-1 searches the score file for the last score, to put point on it, but doesn't set the NOERROR argument of search-forward (the update-game-score program, which updates the score file, chops off a score that is lower than the 200th top score, to keep the list to 200 entries, so the search fails). The minimal fix, in the first patch below, is simply to suppress the error message. A perhaps more user-friendly alternative, in the second patch below, is to also show a message like "Sorry, your score is too low to make the list of top scores." In GNU Emacs 24.2.50.2 (x86_64-suse-linux-gnu, GTK+ Version 3.4.4) of 2012-10-31 on rosalinde Bzr revision: 110748 rudalics@gmx.at-20121031100251-29ks4uo7ift4gzyp Windowing system distributor `The X.Org Foundation', version 11.0.11203000 System Description: openSUSE 12.2 (x86_64) --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: gamegrid patch 1 2012-11-01 Stephen Berman * play/gamegrid.el (gamegrid-add-score-with-update-game-score-1): Don't signal an error with a score that is too low to add to the list of top scores. (Bug#xxxxxx) === modified file 'lisp/play/gamegrid.el' *** lisp/play/gamegrid.el 2012-07-11 23:13:41 +0000 --- lisp/play/gamegrid.el 2012-11-01 18:53:59 +0000 *************** *** 560,566 **** (goto-char (point-min)) (search-forward (concat (int-to-string score) " " (user-login-name) " " ! marker-string)) (beginning-of-line))))) (defun gamegrid-add-score-insecure (file score &optional directory) --- 560,566 ---- (goto-char (point-min)) (search-forward (concat (int-to-string score) " " (user-login-name) " " ! marker-string) nil t) (beginning-of-line))))) (defun gamegrid-add-score-insecure (file score &optional directory) --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: gamegrid patch 2 2012-11-01 Stephen Berman * play/gamegrid.el (gamegrid-add-score-with-update-game-score-1): Don't signal an error with a score that is too low to add to the list of top scores, but inform the user. (Bug#xxxxxx) === modified file 'lisp/play/gamegrid.el' *** lisp/play/gamegrid.el 2012-07-11 23:13:41 +0000 --- lisp/play/gamegrid.el 2012-11-01 20:03:28 +0000 *************** *** 558,567 **** (display-buffer buf)) (find-file-read-only target)) (goto-char (point-min)) ! (search-forward (concat (int-to-string score) ! " " (user-login-name) " " ! marker-string)) ! (beginning-of-line))))) (defun gamegrid-add-score-insecure (file score &optional directory) (save-excursion --- 558,569 ---- (display-buffer buf)) (find-file-read-only target)) (goto-char (point-min)) ! (if (search-forward (concat (int-to-string score) ! " " (user-login-name) " " ! marker-string) nil t) ! (beginning-of-line) ! (message ! "Sorry, your score was too low to make the list of top scores.")))))) (defun gamegrid-add-score-insecure (file score &optional directory) (save-excursion --=-=-=--