]> code.delx.au - gnu-emacs/blobdiff - lisp/play/mpuz.el
Remove compatibility with Emacs 24.3 in octave-mode
[gnu-emacs] / lisp / play / mpuz.el
index 4c6d66b27ae9385ac2e24a9324639b9c66cc6369..377e7b732a68a2debb5bf5e46f65f2e5fffadd72 100644 (file)
@@ -1,7 +1,6 @@
 ;;; mpuz.el --- multiplication puzzle for GNU Emacs
 
-;; Copyright (C) 1990, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-;;   2009, 2010, 2011  Free Software Foundation, Inc.
+;; Copyright (C) 1990, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: Philippe Schnoebelen <phs@lsv.ens-cachan.fr>
 ;; Overhauled: Daniel Pfeiffer <occitan@esperanto.org>
@@ -36,8 +35,6 @@
   :prefix "mpuz-"
   :group 'games)
 
-(random t)                             ; randomize
-
 (defcustom mpuz-silent 'error
   "Set this to nil if you want dings on inputs.
 The value t means never ding, and `error' means only ding on wrong input."
@@ -57,26 +54,26 @@ The value t means never ding, and `error' means only ding on wrong input."
   :group 'mpuz)
 
 (defface mpuz-unsolved
-  '((((class color)) (:foreground "red1" :bold t))
-    (t (:bold t)))
-  "Face to use for letters to be solved."
+  '((default :weight bold)
+    (((class color)) :foreground "red1"))
+  "Face 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."
+  '((default :weight bold)
+    (((class color)) :foreground "green1"))
+  "Face 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."
+  '((default :weight bold)
+    (((class color)) :foreground "blue"))
+  "Face for trivial digits solved for you."
   :group 'mpuz)
 
 (defface mpuz-text
-  '((t (:inherit variable-pitch)))
-  "Face to use for text on right."
+  '((t :inherit variable-pitch))
+  "Face for text on right."
   :group 'mpuz)
 
 \f
@@ -97,7 +94,9 @@ The value t means never ding, and `error' means only ding on wrong input."
     map)
   "Local keymap to use in Mult Puzzle.")
 
-(defun mpuz-mode ()
+
+
+(define-derived-mode mpuz-mode fundamental-mode "Mult Puzzle"
   "Multiplication puzzle mode.
 
 You have to guess which letters stand for which digits in the
@@ -109,13 +108,7 @@ then the digit.  Thus, to guess that A=3, type `A 3'.
 To leave the game to do other editing work, just switch buffers.
 Then you may resume the game with M-x mpuz.
 You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]."
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'mpuz-mode
-       mode-name  "Mult Puzzle"
-       tab-width 30)
-  (use-local-map mpuz-mode-map)
-  (run-mode-hooks 'mpuz-mode-hook))
+  (setq tab-width 30))
 
 \f
 ;; Some variables for statistics
@@ -406,7 +399,7 @@ You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]."
   "Propose a digit for a letter in puzzle."
   (interactive)
   (if mpuz-in-progress
-      (let (letter-char digit digit-char message)
+      (let (letter-char digit digit-char)
        (setq letter-char (upcase last-command-event)
              digit (mpuz-to-digit (- letter-char ?A)))
        (cond ((mpuz-digit-solved-p digit)
@@ -435,8 +428,7 @@ You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]."
   "Propose LETTER-CHAR as code for DIGIT-CHAR."
   (let* ((letter (- letter-char ?A))
         (digit (- digit-char ?0))
-        (correct-digit (mpuz-to-digit letter))
-        (game mpuz-nb-completed-games))
+        (correct-digit (mpuz-to-digit letter)))
     (cond ((mpuz-digit-solved-p correct-digit)
           (message "%c has already been found." (+ correct-digit ?0)))
          ((mpuz-digit-solved-p digit)
@@ -499,5 +491,4 @@ You may abort a game by typing \\<mpuz-mode-map>\\[mpuz-offer-abort]."
 
 (provide 'mpuz)
 
-;; arch-tag: 2781d6ba-89e7-43b5-85c7-5d3a2e73feb1
 ;;; mpuz.el ends here