X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/7ad8fe5e2876518a8f33b80050f98dab4ff78398..73b0cd50031a714347109169ceb8bacae338612a:/lisp/play/5x5.el diff --git a/lisp/play/5x5.el b/lisp/play/5x5.el index 30a13cba92..364ea35af3 100644 --- a/lisp/play/5x5.el +++ b/lisp/play/5x5.el @@ -1,7 +1,6 @@ ;;; 5x5.el --- simple little puzzle game -;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 1999-2011 Free Software Foundation, Inc. ;; Author: Dave Pearson ;; Maintainer: Dave Pearson @@ -59,32 +58,32 @@ :prefix "5x5-") (defcustom 5x5-grid-size 5 - "*Size of the playing area." + "Size of the playing area." :type 'integer :group '5x5) (defcustom 5x5-x-scale 4 - "*X scaling factor for drawing the grid." + "X scaling factor for drawing the grid." :type 'integer :group '5x5) (defcustom 5x5-y-scale 3 - "*Y scaling factor for drawing the grid." + "Y scaling factor for drawing the grid." :type 'integer :group '5x5) (defcustom 5x5-animate-delay .01 - "*Delay in seconds when animating a solution crack." + "Delay in seconds when animating a solution crack." :type 'number :group '5x5) (defcustom 5x5-hassle-me t - "*Should 5x5 ask you when you want to do a destructive operation?" + "Should 5x5 ask you when you want to do a destructive operation?" :type 'boolean :group '5x5) (defcustom 5x5-mode-hook nil - "*Hook run on starting 5x5." + "Hook run on starting 5x5." :type 'hook :group '5x5) @@ -108,12 +107,7 @@ (defvar 5x5-buffer-name "*5x5*" "Name of the 5x5 play buffer.") -(defvar 5x5-mode-map nil - "Local keymap for the 5x5 game.") - -;; Keymap. - -(unless 5x5-mode-map +(defvar 5x5-mode-map (let ((map (make-sparse-keymap))) (suppress-keymap map t) (define-key map "?" #'describe-mode) @@ -141,7 +135,8 @@ (define-key map [(control c) (control x)] #'5x5-crack-xor-mutate) (define-key map "n" #'5x5-new-game) (define-key map "q" #'5x5-quit-game) - (setq 5x5-mode-map map))) + map) + "Local keymap for the 5x5 game.") ;; Menu definition. @@ -211,7 +206,8 @@ Quit current game \\[5x5-quit-game]" (defun 5x5-new-game () "Start a new game of `5x5'." (interactive) - (when (if (interactive-p) (5x5-y-or-n-p "Start a new game? ") t) + (when (if (called-interactively-p 'interactive) + (5x5-y-or-n-p "Start a new game? ") t) (setq 5x5-x-pos (/ 5x5-grid-size 2) 5x5-y-pos (/ 5x5-grid-size 2) 5x5-moves 0 @@ -300,7 +296,8 @@ Quit current game \\[5x5-quit-game]" (defun 5x5-position-cursor () "Position the cursor on the grid." - (goto-line (+ (* 5x5-y-pos 5x5-y-scale) 2)) + (goto-char (point-min)) + (forward-line (1+ (* 5x5-y-pos 5x5-y-scale))) (goto-char (+ (point) (* 5x5-x-pos 5x5-x-scale) (+ 5x5-x-pos 1) 1))) (defun 5x5-made-move () @@ -514,5 +511,4 @@ in progress because it is an animated attempt." (provide '5x5) -;; arch-tag: ec4dabd5-572d-41ea-b48c-ec5ce0d68fa9 ;;; 5x5.el ends here