summaryrefslogtreecommitdiff
path: root/lisp/play/snake.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-01-31 05:27:06 +0100
committerStefan Kangas <stefan@marxist.se>2021-01-31 05:28:40 +0100
commit31ec1a7d329cc9374b16c5831d30248c99e93dfb (patch)
treef57d9e6dfaee038bf866945a37bf1c6380652fb0 /lisp/play/snake.el
parente226357c3b651b525e82933423f84f497395432f (diff)
downloademacs-31ec1a7d329cc9374b16c5831d30248c99e93dfb.tar.gz
Prefer defvar-local in play/*.el
* lisp/play/5x5.el (5x5-grid, 5x5-x-pos, 5x5-y-pos, 5x5-moves, 5x5-cracking): * lisp/play/decipher.el (decipher-alphabet) (decipher-stats-buffer, decipher-undo-list-size) (decipher-undo-list): * lisp/play/gamegrid.el (gamegrid-use-glyphs) (gamegrid-use-color, gamegrid-font, gamegrid-face) (gamegrid-display-options, gamegrid-buffer-width) (gamegrid-buffer-height, gamegrid-blank, gamegrid-timer) (gamegrid-display-mode, gamegrid-display-table) (gamegrid-face-table, gamegrid-buffer-start) (gamegrid-score-file-length): * lisp/play/snake.el (snake-length, snake-velocity-x) (snake-velocity-y, snake-positions, snake-score, snake-paused) (snake-moved-p, snake-velocity-queue): * lisp/play/tetris.el (tetris-shape, tetris-rot) (tetris-next-shape, tetris-n-shapes, tetris-n-rows) (tetris-score, tetris-pos-x, tetris-pos-y, tetris-paused): Prefer defvar-local. * lisp/play/5x5.el (5x5-defvar-local): Make obsolete.
Diffstat (limited to 'lisp/play/snake.el')
-rw-r--r--lisp/play/snake.el26
1 files changed, 8 insertions, 18 deletions
diff --git a/lisp/play/snake.el b/lisp/play/snake.el
index 5584bf88103..bed7cea6ee5 100644
--- a/lisp/play/snake.el
+++ b/lisp/play/snake.el
@@ -140,14 +140,14 @@
;; ;;;;;;;;;;;;; variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar snake-length 0)
-(defvar snake-velocity-x 1)
-(defvar snake-velocity-y 0)
-(defvar snake-positions nil)
-(defvar snake-score 0)
-(defvar snake-paused nil)
-(defvar snake-moved-p nil)
-(defvar snake-velocity-queue nil
+(defvar-local snake-length 0)
+(defvar-local snake-velocity-x 1)
+(defvar-local snake-velocity-y 0)
+(defvar-local snake-positions nil)
+(defvar-local snake-score 0)
+(defvar-local snake-paused nil)
+(defvar-local snake-moved-p nil)
+(defvar-local snake-velocity-queue nil
"This queue stores the velocities requested too quickly by user.
They will take effect one at a time at each clock-interval.
This is necessary for proper behavior.
@@ -158,16 +158,6 @@ we implemented all your keystrokes immediately, the snake would
effectively never move up. Thus, we need to move it up for one turn
and then start moving it leftwards.")
-
-(make-variable-buffer-local 'snake-length)
-(make-variable-buffer-local 'snake-velocity-x)
-(make-variable-buffer-local 'snake-velocity-y)
-(make-variable-buffer-local 'snake-positions)
-(make-variable-buffer-local 'snake-score)
-(make-variable-buffer-local 'snake-paused)
-(make-variable-buffer-local 'snake-moved-p)
-(make-variable-buffer-local 'snake-velocity-queue)
-
;; ;;;;;;;;;;;;; keymaps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar snake-mode-map