From: kaoru Date: Fri, 4 Jun 2004 09:57:06 +0000 (+0000) Subject: * riece-hangman.el (riece-hangman-word): Check killed-buffer or X-Git-Tag: riece-1_0_1~21 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=2b2f90e7d27046cf2cf522776c23ae64761f8692;p=elisp%2Friece.git * riece-hangman.el (riece-hangman-word): Check killed-buffer or not. Fix random number generation logic. --- 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))