X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/4f9d7df139695e97cd1772d41940500480585df7..528b9ea9fff19090ae08197fd4b7ccd9b26caa47:/lisp/play/mpuz.el diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el index 3c1a9fda95..954730c949 100644 --- a/lisp/play/mpuz.el +++ b/lisp/play/mpuz.el @@ -1,7 +1,7 @@ ;;; mpuz.el --- multiplication puzzle for GNU Emacs -;; Copyright (C) 1990, 2001, 2002, 2003, 2004, 2005, -;; 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 1990, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +;; 2009, 2010 Free Software Foundation, Inc. ;; Author: Philippe Schnoebelen ;; Overhauled: Daniel Pfeiffer @@ -39,7 +39,7 @@ (random t) ; randomize (defcustom mpuz-silent 'error - "*Set this to nil if you want dings on inputs. + "Set this to nil if you want dings on inputs. t means never ding, and `error' means only ding on wrong input." :type '(choice (const :tag "No" nil) (const :tag "Yes" t) @@ -47,36 +47,36 @@ t means never ding, and `error' means only ding on wrong input." :group 'mpuz) (defcustom mpuz-solve-when-trivial t - "*Solve any row that can be trivially calculated from what you've found." + "Solve any row that can be trivially calculated from what you've found." :type 'boolean :group 'mpuz) (defcustom mpuz-allow-double-multiplicator nil - "*Allow 2nd factors like 33 or 77." + "Allow 2nd factors like 33 or 77." :type 'boolean :group 'mpuz) (defface mpuz-unsolved '((((class color)) (:foreground "red1" :bold t)) (t (:bold t))) - "*Face to use for letters to be solved." + "Face to use for letters to be solved." :group 'mpuz) (defface mpuz-solved '((((class color)) (:foreground "green1" :bold t)) (t (:bold t))) - "*Face to use for solved digits." + "Face to use for solved digits." :group 'mpuz) (defface mpuz-trivial '((((class color)) (:foreground "blue" :bold t)) (t (:bold t))) - "*Face to use for trivial digits solved for you." + "Face to use for trivial digits solved for you." :group 'mpuz) (defface mpuz-text '((t (:inherit variable-pitch))) - "*Face to use for text on right." + "Face to use for text on right." :group 'mpuz) @@ -298,8 +298,7 @@ You may abort a game by typing \\\\[mpuz-offer-abort]." (let ((buf (get-buffer-create "*Mult Puzzle*")) (face '(face mpuz-text)) buffer-read-only) - (save-excursion - (set-buffer buf) + (with-current-buffer buf (erase-buffer) (insert mpuz-framework) (set-text-properties 13 42 face) @@ -320,12 +319,14 @@ You may abort a game by typing \\\\[mpuz-offer-abort]." (defun mpuz-paint-errors () "Paint error count on the puzzle screen." (mpuz-switch-to-window) - (goto-line 3) + (goto-char (point-min)) + (forward-line 2) (mpuz-paint-number (prin1-to-string mpuz-nb-errors))) (defun mpuz-paint-statistics () "Paint statistics about previous games on the puzzle screen." - (goto-line 7) + (goto-char (point-min)) + (forward-line 6) (mpuz-paint-number (prin1-to-string mpuz-nb-completed-games)) (mpuz-paint-number (format "%.2f" @@ -352,7 +353,8 @@ You may abort a game by typing \\\\[mpuz-offer-abort]." ('mpuz-unsolved)))) buffer-read-only) (mapc (lambda (square) - (goto-line (car square)) ; line before column! + (goto-char (point-min)) + (forward-line (1- (car square))) ; line before column! (move-to-column (cdr square)) (insert char) (set-text-properties (1- (point)) (point) face) @@ -424,7 +426,7 @@ You may abort a game by typing \\\\[mpuz-offer-abort]." (interactive) (if mpuz-in-progress (let (letter-char digit digit-char message) - (setq letter-char (upcase last-command-char) + (setq letter-char (upcase last-command-event) digit (mpuz-to-digit (- letter-char ?A))) (cond ((mpuz-digit-solved-p digit) (message "%c already solved." letter-char)