]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer defvar-local in play/*.el
authorStefan Kangas <stefan@marxist.se>
Sun, 31 Jan 2021 04:27:06 +0000 (05:27 +0100)
committerStefan Kangas <stefan@marxist.se>
Sun, 31 Jan 2021 04:28:40 +0000 (05:28 +0100)
* 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.

lisp/play/5x5.el
lisp/play/decipher.el
lisp/play/gamegrid.el
lisp/play/snake.el
lisp/play/tetris.el

index 07ef30c07d1763cac0d66838b7be7ac63f16cf7f..c89188c0233a31a492d6505ec0d7b27976c0d2b6 100644 (file)
 
 (defmacro 5x5-defvar-local (var value doc)
   "Define VAR to VALUE with documentation DOC and make it buffer local."
+  (declare (obsolete defvar-local "28.1"))
   `(progn
      (defvar ,var ,value ,doc)
      (make-variable-buffer-local (quote ,var))))
 
-(5x5-defvar-local 5x5-grid nil
+(defvar-local 5x5-grid nil
   "5x5 grid contents.")
 
-(5x5-defvar-local 5x5-x-pos 2
+(defvar-local 5x5-x-pos 2
   "X position of cursor.")
 
-(5x5-defvar-local 5x5-y-pos 2
+(defvar-local 5x5-y-pos 2
   "Y position of cursor.")
 
-(5x5-defvar-local 5x5-moves 0
+(defvar-local 5x5-moves 0
   "Moves made.")
 
-(5x5-defvar-local 5x5-cracking nil
+(defvar-local 5x5-cracking nil
   "Are we in cracking mode?")
 
 (defvar 5x5-buffer-name "*5x5*"
index a7a4b89c372b043d03a9f8caacac413f34d2c23c..b870bfb4a19b3626b5af8513a4f0cb86ddbbb695 100644 (file)
@@ -184,28 +184,24 @@ the tail of the list."
       (cl-incf c))
     (setq decipher-mode-syntax-table table)))
 
-(defvar decipher-alphabet nil)
+(defvar-local decipher-alphabet nil)
 ;; This is an alist containing entries (PLAIN-CHAR . CIPHER-CHAR),
 ;; where PLAIN-CHAR runs from ?a to ?z and CIPHER-CHAR is an uppercase
 ;; letter or space (which means no mapping is known for that letter).
 ;; This *must* contain entries for all lowercase characters.
-(make-variable-buffer-local 'decipher-alphabet)
 
-(defvar decipher-stats-buffer nil
+(defvar-local decipher-stats-buffer nil
   "The buffer which displays statistics for this ciphertext.
 Do not access this variable directly, use the function
 `decipher-stats-buffer' instead.")
-(make-variable-buffer-local 'decipher-stats-buffer)
 
-(defvar decipher-undo-list-size 0
+(defvar-local decipher-undo-list-size 0
   "The number of entries in the undo list.")
-(make-variable-buffer-local 'decipher-undo-list-size)
 
-(defvar decipher-undo-list nil
+(defvar-local decipher-undo-list nil
   "The undo list for this buffer.
 Each element is either a cons cell (PLAIN-CHAR . CIPHER-CHAR) or a
 list of such cons cells.")
-(make-variable-buffer-local 'decipher-undo-list)
 
 (defvar decipher-pending-undo-list nil)
 
index e540ca723d06159e7c4f8fa9cdd45f4d7821c80a..34787d928eb41474d924edeaabcc971277c5b290 100644 (file)
 
 ;; ;;;;;;;;;;;;; buffer-local variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defvar gamegrid-use-glyphs t
+(defvar-local gamegrid-use-glyphs t
   "Non-nil means use glyphs when available.")
 
-(defvar gamegrid-use-color t
+(defvar-local gamegrid-use-color t
   "Non-nil means use color when available.")
 
-(defvar gamegrid-font "-*-courier-medium-r-*-*-*-140-100-75-*-*-iso8859-*"
+(defvar-local gamegrid-font "-*-courier-medium-r-*-*-*-140-100-75-*-*-iso8859-*"
   "Name of the font used in X mode.")
 
-(defvar gamegrid-face nil
+(defvar-local gamegrid-face nil
   "Indicates the face to use as a default.")
-(make-variable-buffer-local 'gamegrid-face)
 
-(defvar gamegrid-display-options nil)
+(defvar-local gamegrid-display-options nil)
 
-(defvar gamegrid-buffer-width 0)
-(defvar gamegrid-buffer-height 0)
-(defvar gamegrid-blank 0)
+(defvar-local gamegrid-buffer-width 0)
+(defvar-local gamegrid-buffer-height 0)
+(defvar-local gamegrid-blank 0)
 
-(defvar gamegrid-timer nil)
+(defvar-local gamegrid-timer nil)
 
-(defvar gamegrid-display-mode nil)
+(defvar-local gamegrid-display-mode nil)
 
-(defvar gamegrid-display-table)
+(defvar-local gamegrid-display-table)
 
-(defvar gamegrid-face-table nil)
+(defvar-local gamegrid-face-table nil)
 
-(defvar gamegrid-buffer-start 1)
+(defvar-local gamegrid-buffer-start 1)
 
-(defvar gamegrid-score-file-length 50
+(defvar-local gamegrid-score-file-length 50
   "Number of high scores to keep.")
 
 (defvar gamegrid-user-score-file-directory
 If Emacs was built without support for shared game scores, then this
 directory will be used.")
 
-(make-variable-buffer-local 'gamegrid-use-glyphs)
-(make-variable-buffer-local 'gamegrid-use-color)
-(make-variable-buffer-local 'gamegrid-font)
-(make-variable-buffer-local 'gamegrid-display-options)
-(make-variable-buffer-local 'gamegrid-buffer-width)
-(make-variable-buffer-local 'gamegrid-buffer-height)
-(make-variable-buffer-local 'gamegrid-blank)
-(make-variable-buffer-local 'gamegrid-timer)
-(make-variable-buffer-local 'gamegrid-display-mode)
-(make-variable-buffer-local 'gamegrid-display-table)
-(make-variable-buffer-local 'gamegrid-face-table)
-(make-variable-buffer-local 'gamegrid-buffer-start)
-(make-variable-buffer-local 'gamegrid-score-file-length)
 
 ;; ;;;;;;;;;;;;; global variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
index 5584bf881036e96bb00c3ba6ae1ac416e9df0d59..bed7cea6ee5edddbaae01e5ccf605dcbc81e22d5 100644 (file)
 
 ;; ;;;;;;;;;;;;; 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
index 8205d3f79c507938f50c56eb3b7d59f8576d1a10..05e4ffe01119ee1bcae52e758b88b62579c5ecbd 100644 (file)
@@ -224,25 +224,15 @@ each one of its four blocks.")
 
 ;; ;;;;;;;;;;;;; variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defvar tetris-shape 0)
-(defvar tetris-rot 0)
-(defvar tetris-next-shape 0)
-(defvar tetris-n-shapes 0)
-(defvar tetris-n-rows 0)
-(defvar tetris-score 0)
-(defvar tetris-pos-x 0)
-(defvar tetris-pos-y 0)
-(defvar tetris-paused nil)
-
-(make-variable-buffer-local 'tetris-shape)
-(make-variable-buffer-local 'tetris-rot)
-(make-variable-buffer-local 'tetris-next-shape)
-(make-variable-buffer-local 'tetris-n-shapes)
-(make-variable-buffer-local 'tetris-n-rows)
-(make-variable-buffer-local 'tetris-score)
-(make-variable-buffer-local 'tetris-pos-x)
-(make-variable-buffer-local 'tetris-pos-y)
-(make-variable-buffer-local 'tetris-paused)
+(defvar-local tetris-shape 0)
+(defvar-local tetris-rot 0)
+(defvar-local tetris-next-shape 0)
+(defvar-local tetris-n-shapes 0)
+(defvar-local tetris-n-rows 0)
+(defvar-local tetris-score 0)
+(defvar-local tetris-pos-x 0)
+(defvar-local tetris-pos-y 0)
+(defvar-local tetris-paused nil)
 
 ;; ;;;;;;;;;;;;; keymaps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;