unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Patch: blackbox.el
@ 2002-09-18 20:16 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2002-09-18 20:16 UTC (permalink / raw)


I recently noticed that the movement commands in blackbox.el don't
respect a prefix argument.  This patch adds that.

Tom


2002-09-18  Tom Tromey  <tromey@redhat.com>

	* play/blackbox.el (bb-right): Respect prefix argument.
	(bb-left): Likewise.
	(bb-up): Likewise.
	(bb-down): Likewise.

Index: play/blackbox.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/play/blackbox.el,v
retrieving revision 1.12
diff -u -r1.12 blackbox.el
--- play/blackbox.el 20 Dec 2001 06:50:42 -0000 1.12
+++ play/blackbox.el 18 Sep 2002 20:17:15 -0000
@@ -1,6 +1,6 @@
 ;;; blackbox.el --- blackbox game in Emacs Lisp
 
-;; Copyright (C) 1985, 1986, 1987, 1992, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1987, 1992, 2001, 2002 Free Software Foundation, Inc.
 
 ;; Author: F. Thomas May <uw-nsr!uw-warp!tom@beaver.cs.washington.edu>
 ;; Adapted-By: ESR
@@ -275,33 +275,33 @@
     (insert (format "\nThere are %d balls in the box" (length bb-board)))
     ))
 
-(defun bb-right ()
-  (interactive)
-  (if (= bb-x 8)
-      ()
+(defun bb-right (count)
+  (interactive "p")
+  (while (and (> count 0) (< bb-x 8))
     (forward-char 2)
-    (setq bb-x (1+ bb-x))))
+    (setq bb-x (1+ bb-x))
+    (setq count (1- count))))
 
-(defun bb-left ()
-  (interactive)
-  (if (= bb-x -1)
-      ()
+(defun bb-left (count)
+  (interactive "p")
+  (while (and (> count 0) (> bb-x -1))
     (backward-char 2)
-    (setq bb-x (1- bb-x))))
+    (setq bb-x (1- bb-x))
+    (setq count (1- count))))
 
-(defun bb-up ()
-  (interactive)
-  (if (= bb-y -1)
-      ()
+(defun bb-up (count)
+  (interactive "p")
+  (while (and (> count 0) (> bb-y -1))
     (previous-line 1)
-    (setq bb-y (1- bb-y))))
+    (setq bb-y (1- bb-y))
+    (setq count (1- count))))
 
-(defun bb-down ()
-  (interactive)
-  (if (= bb-y 8)
-      ()
+(defun bb-down (count)
+  (interactive "p")
+  (while (and (> count 0) (< bb-y 8))
     (next-line 1)
-    (setq bb-y (1+ bb-y))))
+    (setq bb-y (1+ bb-y))
+    (setq count (1- count))))
 
 (defun bb-eol ()
   (interactive)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-09-18 20:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-18 20:16 Patch: blackbox.el Tom Tromey

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).