]> code.delx.au - gnu-emacs/blobdiff - lisp/play/blackbox.el
Update copyright year to 2016
[gnu-emacs] / lisp / play / blackbox.el
index eb2d784c8e523c1f8b28f26f97cc547b083a3955..10ea2930b12133da30afcd13205aa7c4c3d2f0f5 100644 (file)
@@ -1,6 +1,7 @@
 ;;; blackbox.el --- blackbox game in Emacs Lisp
 
-;; Copyright (C) 1985-1987, 1992, 2001-2012 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1992, 2001-2016 Free Software Foundation,
+;; Inc.
 
 ;; Author: F. Thomas May <uw-nsr!uw-warp!tom@beaver.cs.washington.edu>
 ;; Adapted-By: ESR
   (define-key map (vector 'remap oldfun) newfun))
 
 
-(defvar blackbox-mode-map 
+(defvar blackbox-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map t)
     (blackbox-redefine-key map 'backward-char 'bb-left)
+    (blackbox-redefine-key map 'left-char 'bb-left)
     (blackbox-redefine-key map 'forward-char 'bb-right)
+    (blackbox-redefine-key map 'right-char 'bb-right)
     (blackbox-redefine-key map 'previous-line 'bb-up)
     (blackbox-redefine-key map 'next-line 'bb-down)
     (blackbox-redefine-key map 'move-end-of-line 'bb-eol)
     map))
 
 ;; Blackbox mode is suitable only for specially formatted data.
-(put 'blackbox-mode 'mode-class 'special)
 
-(defun blackbox-mode ()
+(define-derived-mode blackbox-mode special-mode "Blackbox"
   "Major mode for playing blackbox.
 To learn how to play blackbox, see the documentation for function `blackbox'.
 
@@ -121,13 +123,7 @@ The usual mnemonic keys move the cursor around the box.
 
 \\[bb-romp] -- send in a ray from point, or toggle a ball at point
 \\[bb-done] -- end game and get score"
-  (interactive)
-  (kill-all-local-variables)
-  (use-local-map blackbox-mode-map)
-  (setq truncate-lines t)
-  (setq major-mode 'blackbox-mode)
-  (setq mode-name "Blackbox")
-  (run-mode-hooks 'blackbox-mode-hook))
+  (setq truncate-lines t))
 
 ;;;###autoload
 (defun blackbox (num)
@@ -257,7 +253,6 @@ a reflection."
   (bb-goto (cons bb-x bb-y)))
 
 (defun bb-init-board (num-balls)
-  (random t)
   (let (board pos)
     (while (>= (setq num-balls (1- num-balls)) 0)
       (while