From 2b2f90e7d27046cf2cf522776c23ae64761f8692 Mon Sep 17 00:00:00 2001 From: kaoru Date: Fri, 4 Jun 2004 09:57:06 +0000 Subject: [PATCH] * riece-hangman.el (riece-hangman-word): Check killed-buffer or not. Fix random number generation logic. --- lisp/ChangeLog | 5 +++++ lisp/riece-hangman.el | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 66b3c6e..37df294 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2004-06-04 TAKAHASHI Kaoru + + * riece-hangman.el (riece-hangman-word): Check killed-buffer or + not. Fix random number generation logic. + 2004-06-03 Daiki Ueno * riece-server.el (riece-open-server): When password input is diff --git a/lisp/riece-hangman.el b/lisp/riece-hangman.el index 0f79838..c4fd54c 100644 --- a/lisp/riece-hangman.el +++ b/lisp/riece-hangman.el @@ -96,7 +96,8 @@ This function is for internal use only." (defun riece-hangman-word () "Return random word. The wordlist is read from `riece-hangman-words-file'." - (unless riece-hangman-words-buffer + (unless (and riece-hangman-words-buffer + (buffer-name riece-hangman-words-buffer)) (setq riece-hangman-words-buffer (generate-new-buffer " *riece-hangman*")) (save-excursion (set-buffer riece-hangman-words-buffer) @@ -106,7 +107,7 @@ The wordlist is read from `riece-hangman-words-file'." (delete-non-matching-lines "^[a-z][a-z][a-z][a-z][a-z][a-z]+")))) (save-excursion (set-buffer riece-hangman-words-buffer) - (goto-char (% (1+ (random)) (buffer-size))) + (goto-char (1+ (random (buffer-size)))) (if (eobp) (beginning-of-line -1) (beginning-of-line)) -- 1.7.10.4