GNU bug report logs - #12779
24.2.50; Gamegrid signals an error when score is too low

Previous Next

Package: emacs;

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

Date: Thu, 1 Nov 2012 21:07: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 12779 in the body.
You can then email your comments to 12779 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#12779; Package emacs. (Thu, 01 Nov 2012 21:07: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. (Thu, 01 Nov 2012 21:07: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; Gamegrid signals an error when score is too low
Date: Thu, 01 Nov 2012 22:03:40 +0100
[Message part 1 (text/plain, inline)]
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 <stephen.berman <at> gmx.net>  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 <Stephen.Berman <at> gmx.net>
(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 <at> gmx.at-20121031100251-29ks4uo7ift4gzyp
Windowing system distributor `The X.Org Foundation', version 11.0.11203000
System Description:	openSUSE 12.2 (x86_64)


[Message part 2 (text/x-patch, inline)]
2012-11-01  Stephen Berman  <stephen.berman <at> gmx.net>

	* 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)

[Message part 3 (text/x-patch, inline)]
2012-11-01  Stephen Berman  <stephen.berman <at> gmx.net>

	* 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


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

Notification sent to Stephen Berman <stephen.berman <at> gmx.net>:
bug acknowledged by developer. (Sat, 17 Nov 2012 07:03:03 GMT) Full text and rfc822 format available.

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

From: Chong Yidong <cyd <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 12779-done <at> debbugs.gnu.org
Subject: Re: bug#12779: 24.2.50;
	Gamegrid signals an error when score is too low
Date: Sat, 17 Nov 2012 15:01:41 +0800
Stephen Berman <stephen.berman <at> gmx.net> writes:

> 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.

Committed to trunk, thanks.  (I think the second patch is not necessary,
since such messages are not customary).




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

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

Previous Next


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