]> code.delx.au - gnu-emacs-elpa/commitdiff
Don't require `cl'. Miscellaneous cleanups from compiler warnings.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 24 May 2014 20:31:54 +0000 (16:31 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 24 May 2014 20:31:54 +0000 (16:31 -0400)
* .gitignore: Add ELPA's chess-autoloads.el and chess-pkg.el.
* chess-var.el:
* chess-test.el:
* chess-game.el:
* chess-eco.el: Don't require `cl'.
* chess-sound.el (chess-sound-handler): Remove unused var `text'.
* chess-puzzle.el (chess-display-handling-event): Declare.
* chess-pos.el (chess-pos-passed-pawns): Remove unused var `bias'.
(chess--add-candidate): Define as a macro rather than a defsubst so as
to avoid relying on dynamic scoping.
(chess-search-position): Remove unused var `p'.
* chess-polyglot.el (chess-polyglot-book-reload): Simplify, knowing
it's only used for chess-polyglot-book-file.
* chess-ply.el: Don't require `cl'.
(chess-ply--add): Define as a macro rather than a defsubst so as to
avoid relying on dynamic scoping.
* chess-plain.el (chess-plain-draw): Remove unused var `beg'.
* chess-pgn.el (chess-pgn-parse, chess-insert-pgn): Remove unused var
`begin'.
(chess-pgn-mode): Use make-local-variable instead of
make-variable-buffer-local.
(chess-pgn-index): Remove unused var `first-move'.
(chess-game-inhibit-events): Declare.
* chess-module.el: Don't require `cl'.
(chess-module-create): Remove unused var `buffer'.
* chess-kibitz.el (chess-module-game): Declare.
* chess-images.el (chess-images-popup): Remove unused var `display'.
(chess-images-highlight): Remove unused var `inverted'.
(chess-images-init-cache): Remove unused vars `backgrounds' and
`piece-colors'.
* chess-ics1.el (chess-ics1-draw): Remove unused var `beg'.
* chess-ics.el (chess-ics-handle-style12): Remove unused var `plies'.
* chess-engine.el (chess-full-name): Declare.
(chess-engine-filter): Remove unused var `last-point'.
* chess-display.el (chess-display-edit-position): Declare before
first use.
(chess-display-active-p): Define before first use.
(chess-display-search-backward): Remove unused var `err'.
(chess-images-separate-frame, ibuffer-maybe-show-regexps): Declare.
(chess-display-list-buffers): Use cl-letf.
(chess-display-mouse-select-piece): Use (featurep 'xemacs) and simplify.
* chess-crafty.el (chess-crafty-regexp-alist): Remove unused var
`nodes'.
* chess-algebraic.el: Don't require `cl'.
(chess-ply--move-text): Remove unused var `color'.

24 files changed:
.gitignore
chess-algebraic.el
chess-autosave.el
chess-chat.el
chess-crafty.el
chess-display.el
chess-eco.el
chess-engine.el
chess-game.el
chess-ics.el
chess-ics1.el
chess-images.el
chess-kibitz.el
chess-module.el
chess-pgn.el
chess-plain.el
chess-ply.el
chess-polyglot.el
chess-pos.el
chess-puzzle.el
chess-sound.el
chess-test.el
chess-tutorial.el
chess-var.el

index 069edea3d433e53ce6c55f3f48c6587c7c68d1cb..9c1720e6bfaa8a44960ca4116434faed67139500 100644 (file)
@@ -17,6 +17,8 @@
 /TAGS
 /auto-autoloads.el
 /chess-auto.el
+/chess-autoloads.el
+/chess-pkg.el
 /chess-test
 /config.log
 /config.status
index 4a5e11ce88a1e413f95dd4f7c47baf88e4f71e14..c0d4038420e8eabb552fb2333c542a2671296efb 100644 (file)
@@ -52,7 +52,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'chess-message)
 (require 'chess-pos)
@@ -167,7 +167,6 @@ This regexp handles both long and short form.")
          (from (chess-ply-source ply))
          (to (chess-ply-target ply))
          (from-piece (chess-pos-piece pos from))
-         (color (chess-pos-side-to-move pos))
          (rank 0) (file 0)
          (from-rank (chess-index-rank from))
          (from-file (chess-index-file from))
index 2708d24159e3bde0666f7eca1ba97f861a41c72d..aa8661fc221e540704afa49ad734f90b5262f584 100644 (file)
@@ -51,7 +51,7 @@ to the user."
     (chess-disable-autosave . "Disable autosaving for this game? ")
     (autosave-available     . "There is an autosave file; type ~ after connecting to read it")))
 
-(defun chess-autosave-handler (game event &rest args)
+(defun chess-autosave-handler (game event &rest _args)
   (cond
    ((eq event 'initialize)
     (kill-buffer (current-buffer))
@@ -116,7 +116,7 @@ to the user."
   (insert ")"))
 
 (defun chess-autosave-write (game file)
-  "Write a chess GAME to FILE as raw Lisp."
+  "Write a chess GAME to FILE as raw Lisp." ;FIXME: `file' is not used!
   (let ((index (chess-game-index game)))
     (if (or (= 1 index) (and (bobp) (eobp)))
        (progn
@@ -136,7 +136,7 @@ to the user."
     (message nil)))
 
 (defun chess-autosave-read (game file)
-  "Read a chess game as raw Lisp from FILE."
+  "Read a chess game as raw Lisp from FILE." ;FIXME: `file' is not used!
   (goto-char (point-min))
   (chess-game-set-tags game (read (current-buffer)))
   (let* ((plies (read (current-buffer)))
index 339a73d41af57c3f4a15a994db86ef196e196de2..7dec27999568ddf334d98fbe0e48576ba6c79a31 100644 (file)
@@ -47,7 +47,7 @@
   (set-marker chess-chat-input-last (point-max))
   (set-buffer-modified-p nil))
 
-(defun chess-chat-handler (game event &rest args)
+(defun chess-chat-handler (_game event &rest args)
   (cond
    ((eq event 'initialize)
     (kill-buffer (current-buffer))
index 53ff41615b575676fc0fe6ec6bbe7d4174f853ed..ea78090d3d7f5429b53ff9c4b390e8fa7c9e0572 100644 (file)
@@ -76,7 +76,6 @@
              ;; We can translate this information to EPD opcodes
              (let ((depth (read (match-string 1)))
                    (centipawn (read (match-string 2)))
-                   (nodes (match-string 4))
                    (pos (chess-engine-position nil)))
                (chess-pos-set-epd pos 'acd depth)
                (chess-pos-set-epd pos 'ce centipawn)
index a83d95e28c82739ca13af54decd3f6385d546b5a..45e54aa3ba0ca02648f694c40c24d6573c91e900 100644 (file)
@@ -188,6 +188,9 @@ of the board, if non-nil, the board is viewed from White's perspective."
       (chess-game-set-data chess-module-game 'my-color t))
     (chess-display-set-index nil 0)))
 
+(defvar chess-display-edit-position nil)
+(make-variable-buffer-local 'chess-display-edit-position)
+
 (defun chess-display-position (display)
   "Return the position currently viewed on DISPLAY."
   (chess-with-current-buffer display
@@ -381,7 +384,16 @@ also view the same game."
   '((not-your-move . "It is not your turn to move")
     (game-is-over  . "This game is over")))
 
-(defun chess-display-move (display ply &optional prev-pos pos)
+(defsubst chess-display-active-p ()
+  "Return non-nil if the displayed chessboard reflects an active game.
+Basically, it means we are playing, not editing or reviewing."
+  (and (chess-game-data chess-module-game 'active)
+       (= chess-display-index
+         (chess-game-index chess-module-game))
+       (not (chess-game-over-p chess-module-game))
+       (not chess-display-edit-mode)))
+
+(defun chess-display-move (display ply &optional _prev-pos _pos)
   "Move a piece on DISPLAY, by applying the given PLY.
 The position of PLY must match the currently displayed position.
 If only START is given, it must be in algebraic move notation."
@@ -685,15 +697,6 @@ The key bindings available in this mode are:
 ;; Commands used by the keyboard bindings above
 ;;
 
-(defsubst chess-display-active-p ()
-  "Return non-nil if the displayed chessboard reflects an active game.
-Basically, it means we are playing, not editing or reviewing."
-  (and (chess-game-data chess-module-game 'active)
-       (= chess-display-index
-         (chess-game-index chess-module-game))
-       (not (chess-game-over-p chess-module-game))
-       (not chess-display-edit-mode)))
-
 (defun chess-display-invert ()
   "Invert the perspective of the current chess board."
   (interactive)
@@ -808,7 +811,7 @@ Basically, it means we are playing, not editing or reviewing."
 (defun chess-display-search-backward (&optional direction)
   (interactive)
   (setq chess-display-previous-index chess-display-index)
-  (condition-case err
+  (condition-case nil
       (let ((chess-display-search-direction direction)
            (chess-current-display (current-buffer)))
        (read-from-minibuffer "Find algebraic move: " nil
@@ -853,6 +856,8 @@ Basically, it means we are playing, not editing or reviewing."
       (chess-error 'illegal-notation move))
     (chess-display-move nil ply)))
 
+(defvar chess-images-separate-frame)
+
 (defun chess-display-remote (display)
   (interactive "sDisplay this game on X server: ")
   (require 'chess-images)
@@ -968,26 +973,28 @@ Basically, it means we are playing, not editing or reviewing."
        (chess-game-run-hooks chess-module-game 'undo count))
     (ding)))
 
+(defvar ibuffer-maybe-show-regexps)
+
 (defun chess-display-list-buffers ()
-  "List all buffers related to this display's current game."
+  "List all buffders related to this display's current game."
   (interactive)
-  (let ((buffer-list-func (symbol-function 'buffer-list)))
-    (unwind-protect
-       (let ((chess-game chess-module-game)
-             (lb-command (lookup-key ctl-x-map [(control ?b)]))
-             (ibuffer-maybe-show-regexps nil))
-         (fset 'buffer-list
-               (function
-                (lambda (&optional frame)
-                  (delq nil
-                        (mapcar (function
-                                 (lambda (cell)
-                                   (and (bufferp (cdr cell))
-                                        (buffer-live-p (cdr cell))
-                                        (cdr cell))))
-                                (chess-game-hooks chess-game))))))
-         (call-interactively lb-command))
-      (fset 'buffer-list buffer-list-func))))
+  (let ((chess-game chess-module-game)
+        (lb-command (lookup-key ctl-x-map [(control ?b)]))
+        (ibuffer-maybe-show-regexps nil))
+    ;; FIXME: Running "whatever code is bound to `C-x b'" (which could really
+    ;; be anything, if the user is using a completely different key layout, as
+    ;; in Evil, ErgoEmacs, or whatnot) while rebinding buffer-list is
+    ;; pretty risky!
+    (cl-letf (((symbol-function 'buffer-list)
+               (lambda (&optional _frame)
+                 (delq nil
+                       (mapcar (function
+                                (lambda (cell)
+                                  (and (bufferp (cdr cell))
+                                       (buffer-live-p (cdr cell))
+                                       (cdr cell))))
+                               (chess-game-hooks chess-game))))))
+      (call-interactively lb-command))))
 
 (chess-message-catalog 'english
   '((return-to-current . "Use '>' to return to the current position")))
@@ -1026,10 +1033,6 @@ to the end or beginning."
 ;; chess-display-edit-mode (for editing the position directly)
 ;;
 
-(defvar chess-display-edit-position nil)
-
-(make-variable-buffer-local 'chess-display-edit-position)
-
 (defvar chess-display-edit-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map)
@@ -1253,15 +1256,12 @@ Clicking once on a piece selects it; then click on the target location."
 (defun chess-display-mouse-select-piece (event)
   "Select the piece the user clicked on."
   (interactive "e")
-  (if (fboundp 'event-window)          ; XEmacs
+  (if (featurep 'xemacs)
       (progn
        (set-buffer (window-buffer (event-window event)))
        (and (event-point event) (goto-char (event-point event))))
-    (if (equal (event-start event) (event-end event))
-       (progn
-         (set-buffer (window-buffer (posn-window (event-start event))))
-         (goto-char (posn-point (event-start event))))
-      (goto-char (posn-point (event-end event)))))
+    (set-buffer (window-buffer (posn-window (event-end event))))
+    (goto-char (posn-point (event-end event))))
   (chess-display-select-piece))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
index a1a969c0bf26fef5c342df7b13a338353c640bfa..d3ffff054f39c22ac299d420bd47725624624787 100644 (file)
@@ -1,6 +1,6 @@
 ;;; chess-eco.el --- Chess opening classification
 
-;; Copyright (C) 2004  Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2014  Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
 ;; Keywords: games
@@ -20,9 +20,6 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
-
 (require 'chess-game)
 (require 'chess-ply)
 (require 'chess-pos)
@@ -98,7 +95,7 @@
 (chess-message-catalog 'english
   '((announce-opening . "%s (ECO code %s)")))
 
-(defun chess-eco-handler (game event &rest args)
+(defun chess-eco-handler (game event &rest _args)
   "Handle for the `chess-eco' module.
 If you add `chess-eco' to `chess-default-modules', this handler will
 try to figure out if the current position of a game does match a
index fe3122fce126a5fdff794fb9b4f42ebd80938a7b..0fef4b059bc91e3bd63e67bc0971d3abef75d982 100644 (file)
@@ -99,6 +99,8 @@ If conversion fails, this function fired an 'illegal event."
   (or (chess-pgn-to-game pgn)
       (ignore (chess-message 'invalid-pgn))))
 
+(defvar chess-full-name)
+
 (defun chess-engine-default-handler (event &rest args)
   "Default engine response handler."
   (let ((game (chess-engine-game nil)))
@@ -414,7 +416,7 @@ event handler can take care of the data."
 ;; Primary event handler
 ;;
 
-(defun chess-engine-sentinel (proc event)
+(defun chess-engine-sentinel (proc _event)
   (chess-engine-destroy (process-buffer proc)))
 
 (defun chess-engine-filter (proc &optional string)
@@ -423,7 +425,7 @@ event handler can take care of the data."
                 (process-buffer proc)
               (current-buffer)))
        (inhibit-redisplay t)
-       last-point last-line-no-newline)
+        last-line-no-newline)
     (when (buffer-live-p buf)
       (with-current-buffer buf
        (if (stringp proc)
index 334ec701ccdbf390697b06cc0343843355bfe677..aace91bba119f1d1ac602deb8fe1793d5ab463d5 100644 (file)
@@ -26,8 +26,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'chess-ply)
 (require 'chess-pgn)
 
index 13f40c3672f32f2d3efc2980585b87fe3697af49..265a7b1333c59c766fde360b06d53cba61c44915 100644 (file)
@@ -645,8 +645,7 @@ See `chess-ics-game'.")
                                  index (chess-game-index game))))))
            ;; no preceeding ply supplied, so this is a starting position
            (let ((chess-game-inhibit-events t)
-                 (color (chess-pos-side-to-move position))
-                 plies)
+                 (color (chess-pos-side-to-move position)))
              (when (or (= 1 status) (= -1 status))
                (chess-game-set-data game 'my-color (if (= 1 status)
                                                        color (not color)))
index 714b54535232282ca777edc915fc7ec6e28c84b9..ec0c3ed8932bcceba924f7bd167065b7df4828b0 100644 (file)
@@ -1,6 +1,6 @@
 ;;; chess-ics1.el --- Classic ICS1 style chessboard display
 
-;; Copyright (C) 2002, 2005  Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2005, 2014  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Keywords: games
@@ -103,7 +103,7 @@ PERSPECTIVE is t for white or nil for black."
     (erase-buffer)
     (let* ((inverted (not perspective))
           (rank (if inverted 7 0))
-          (file (if inverted 7 0)) beg)
+          (file (if inverted 7 0)))
       (insert "\n      +---+---+---+---+---+---+---+---+\n")
       (while (if inverted (>= rank 0) (< rank 8))
        (if (/= rank (if inverted 7 0))
index 79f7baa94c7011d17f94bb2ee3032cb1370ca39b..9b45593447b4b35b745098cbba332f6afc9f38bf 100644 (file)
@@ -240,9 +240,7 @@ called."
       (let* ((size (float (+ (* (or chess-images-border-width 0) 8)
                             (* chess-images-size 8))))
             (max-char-height (ceiling (/ size (frame-char-height))))
-            (max-char-width  (ceiling (/ size (frame-char-width))))
-            (display (and (stringp chess-images-separate-frame)
-                          chess-images-separate-frame)))
+            (max-char-width  (ceiling (/ size (frame-char-width)))))
        ;; create the frame whenever necessary
        (chess-display-popup-in-frame (+ max-char-height 2)
                                      max-char-width
@@ -311,8 +309,7 @@ chess board are light or dark depending on location."
 Common modes are:
   `selected'    show that the piece has been selected for movement.
   `unselected'  show that the piece has been unselected."
-  (let* ((inverted (not (chess-display-perspective nil)))
-        (pos (chess-display-index-pos nil index))
+  (let* ((pos (chess-display-index-pos nil index))
         (highlight (copy-alist (get-text-property pos 'display))))
     (setcar (last highlight)
            (list (cons "light_square" (if (eq mode :selected)
@@ -509,10 +506,6 @@ This is necessary for bizzare Emacs reasons."
                nil nil nil nil))
 
   (let* ((colors '("black" "white"))
-        (backgrounds (list chess-images-dark-color
-                           chess-images-light-color))
-        (piece-colors (list chess-images-black-color
-                            chess-images-white-color))
         blank name image-data)
     (dotimes (c 2)
       (dotimes (b 2)
index ff0226592c0a1595e68d69ac8296bcf124604dc0..7fbcaab928bc78c730292fa5a4394b54d2434aba 100644 (file)
@@ -41,6 +41,8 @@
   (let ((map (current-local-map)))
     (define-key map [(control ?c) (control ?c)] 'chess-kibitz-save)))
 
+(defvar chess-module-game)
+
 (defun chess-kibitz-save ()
   (interactive)
   (let ((ann (buffer-substring-no-properties chess-kibitz-input-last
index 01feffc03ea024c4e422fba38c1ace92659126f0..c58184401ef48e4fa7625cf5eeb9318321edea48 100644 (file)
@@ -20,8 +20,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'chess-game)
 
@@ -48,7 +47,7 @@
 (defun chess-module-create (derived game &optional buffer-name
                                    &rest ctor-args)
   (let* ((name (symbol-name derived))
-        handler buffer)
+        handler)
     (unless (and (require derived nil t)
                 (setq handler (intern-soft (concat name "-handler"))))
       (chess-error 'no-such-module name))
index 7b8322fc87c3ac43c0c616be8b9c7352226b836e..14cec7a71b3e29c476c79a3bd3211839104afd80 100644 (file)
@@ -149,8 +149,7 @@ Optionally use the supplied STRING instead of the current buffer."
   (if (or (looking-at "\\[")
          (and (search-forward "[" nil t)
               (goto-char (match-beginning 0))))
-      (let ((game (chess-game-create))
-           (begin (point)))
+      (let ((game (chess-game-create)))
        (chess-game-set-tags game nil)
        (while (looking-at "\\[\\(\\S-+\\)\\s-+\\(\".*?\"\\)\\][ \t\n\r]+")
          (chess-game-set-tag game (match-string-no-properties 1)
@@ -246,9 +245,8 @@ PGN text."
                           (t (string-lessp left right))))))))
     (insert (format "[%s \"%s\"]\n" (car tag) (cdr tag))))
   (insert ?\n)
-  (let ((begin (point)))
-    (chess-pgn-insert-plies game 1 (chess-game-plies game))
-    (insert (or (chess-game-tag game "Result") "*") ?\n)))
+  (chess-pgn-insert-plies game 1 (chess-game-plies game))
+  (insert (or (chess-game-tag game "Result") "*") ?\n))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
@@ -290,12 +288,6 @@ PGN text."
         game)
       (chess-error 'could-not-read-pgn))))
 
-(eval-after-load "pcomplete"
-  '(progn
-     (make-variable-buffer-local 'pcomplete-default-completion-function)
-     (make-variable-buffer-local 'pcomplete-command-completion-function)
-     (make-variable-buffer-local 'pcomplete-parse-arguments-function)))
-
 ;;;###autoload
 (define-derived-mode chess-pgn-mode text-mode "PGN"
   "A mode for editing chess PGN files."
@@ -318,9 +310,12 @@ PGN text."
     (define-key map [? ] 'chess-pgn-insert-and-show-position)
 
     (when (require 'pcomplete nil t)
-      (setq pcomplete-default-completion-function 'chess-pgn-completions)
-      (setq pcomplete-command-completion-function 'chess-pgn-completions)
-      (setq pcomplete-parse-arguments-function 'chess-pgn-current-word)
+      (set (make-local-variable 'pcomplete-default-completion-function)
+           'chess-pgn-completions)
+      (set (make-local-variable 'pcomplete-command-completion-function)
+           'chess-pgn-completions)
+      (set (make-local-variable 'pcomplete-parse-arguments-function)
+           'chess-pgn-current-word)
       (define-key map [tab] 'chess-pgn-complete-move))))
 
 ;;;###autoload
@@ -382,7 +377,7 @@ PGN text."
     (when location (goto-char location))
     (if (re-search-backward chess-pgn-move-regexp nil t)
        (let* ((index (string-to-number (match-string 2)))
-              (first-move (match-string 3))
+              ;; (first-move (match-string 3))
               (second-move (match-string 14))
               (ply (1+ (* 2 (1- index)))))
          (if second-move
@@ -414,6 +409,8 @@ PGN text."
        (setq chess-pgn-current-game
              (chess-database-read chess-pgn-database index))))))
 
+(defvar chess-game-inhibit-events)
+
 (defun chess-pgn-create-display ()
   "Return the move index associated with point."
   ;; now find what position we're at in the game
index 8517094641f4468d4eabebd73f7ba8bebec9b31d..7dd66f15db42a47c909cea25feabb8ee762401c4 100644 (file)
@@ -285,7 +285,7 @@ PERSPECTIVE is t for white or nil for black."
     (erase-buffer)
     (let* ((inverted (not perspective))
           (rank (if inverted 7 0))
-          (file (if inverted 7 0)) beg)
+          (file (if inverted 7 0)))
       (when chess-plain-border-style
        (insert ?  (aref chess-plain-border-style 0)
                (make-string (+ 8 (* 7 chess-plain-spacing))
index 726b2e74ad8da2e61fb6208ad4437fab2e2834ba..036ff96adedd7246c5a2501633c4560a51169059 100644 (file)
@@ -59,8 +59,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'chess-pos)
 (require 'chess-algebraic)
@@ -296,18 +295,11 @@ maneuver."
       (chess-ply-any-keyword (chess-pos-preceding-ply
                              (chess-ply-pos ply)) :stalemate :checkmate)))
 
-(eval-when-compile
-  (defvar position)
-  (defvar candidate)
-  (defvar color)
-  (defvar plies)
-  (defvar specific-target))
-
 (defvar chess-ply-throw-if-any nil)
 
-(defsubst chess-ply--add (rank-adj file-adj &optional pos)
+(defmacro chess-ply--add (rank-adj file-adj &optional pos)
   "This is totally a shortcut."
-  (let ((target (or pos (chess-incr-index candidate rank-adj file-adj))))
+  `(let ((target (or ,pos (chess-incr-index candidate ,rank-adj ,file-adj))))
     (if (and (or (not specific-target)
                 (= target specific-target))
             (chess-pos-legal-candidates position color target
@@ -398,8 +390,7 @@ position object passed in."
         ;; pawn movement, which is diagonal 1 when taking, but forward
         ;; 1 or 2 when moving (the most complex piece, actually)
         ((= test-piece ?P)
-         (let* ((bias  (if color -1 1))
-                (ahead (chess-next-index candidate (if color
+         (let* ((ahead (chess-next-index candidate (if color
                                                        chess-direction-north
                                                      chess-direction-south)))
                 (2ahead (when ahead (chess-next-index ahead (if color
index 7c11dd1df058c7ccab4ab6dd18610563123539e3..f1e5d44c62a708a9c6dc110cd9afb8a1917619ff 100644 (file)
@@ -529,10 +529,8 @@ distribute the probability that a move gets picked."
 
 (defun chess-polyglot-book-reload (symbol value)
   (set symbol value)
-  (when (eq symbol 'chess-polyglot-book-file)
-    (setq chess-polyglot-book
-         (when chess-polyglot-book-file
-           (chess-polyglot-book-open chess-polyglot-book-file)))))
+  (setq chess-polyglot-book
+        (when value (chess-polyglot-book-open value))))
 
 (defcustom chess-polyglot-book-file (expand-file-name "chess-polyglot.bin"
                                                      (file-name-directory
index c205069877bf865818de67346119179a4706f6d1..11a28664490c80783ea396513f0861696c3fd8a3 100644 (file)
@@ -705,7 +705,7 @@ Optionally, if INDICES is non-nil those indices are considered as candidates.
 A Pawn whose advance to the eighth rank is not blocked by an
 opposing Pawn in the same file and who does not have to pass one
 on an adjoining file is called a passed Pawn."
-  (let ((seventh (if color 1 6)) (bias (if color -1 1)) (pawn (if color ?p ?P))
+  (let ((seventh (if color 1 6)) (pawn (if color ?p ?P))
        pawns)
     (dolist (index (or pawn-indices
                       (chess-pos-search position (if color ?P ?p))) pawns)
@@ -834,14 +834,10 @@ trying to move a blank square."
 (chess-message-catalog 'english
   '((piece-unrecognized . "Unrecognized piece identifier")))
 
-(eval-when-compile
-  (defvar candidates)
-  (defvar check-only))
-
-(defsubst chess--add-candidate (candidate)
-  (if check-only
-      (throw 'in-check t)
-    (push candidate candidates)))
+(defmacro chess--add-candidate (candidate)
+  `(if check-only
+       (throw 'in-check t)
+     (push ,candidate candidates)))
 
 (defconst chess-white-can-slide-to
   (let ((squares (make-vector 64 nil)))
@@ -899,7 +895,7 @@ If NO-CASTLING is non-nil, do not consider castling moves."
                  piece))
         (test-piece (and (characterp piece)
                          (upcase piece)))
-        p pos candidates)
+         pos candidates)
     (cond
      ;; if the piece is `t', it means to find the candidates resulting
      ;; from any piece movement.  This is useful for testing whether a
index 216aa30498a3a75cfabff66faccf42c245370f8e..d41e6a5fea43615a6f46ecf0634bb9e0f024b37a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; chess-puzzle.el --- Support for viewing and solving chess puzzles
 
-;; Copyright (C) 2002, 2004, 2008  Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2008, 2014  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Maintainer: Mario Lang <mlang@delysid.org>
@@ -51,7 +51,7 @@
     (end-of-puzzles . "There are no more puzzles in this collection")))
 
 ;;;###autoload
-(defun chess-puzzle (file &optional index)
+(defun chess-puzzle (file &optional index) ;FIXME: index not used!
   "Pick a random puzzle from FILE, and solve it against the default engine.
 The spacebar in the display buffer is bound to `chess-puzzle-next',
 making it easy to go on to the next puzzle once you've solved one."
@@ -80,6 +80,8 @@ making it easy to go on to the next puzzle once you've solved one."
        (chess-game-run-hooks (chess-display-game display) 'disable-autosave)
        (chess-puzzle-next)))))
 
+(defvar chess-display-handling-event)
+
 (defun chess-puzzle-next ()
   "Play the next puzzle in the collection, selected randomly."
   (interactive)
@@ -118,7 +120,7 @@ making it easy to go on to the next puzzle once you've solved one."
                     "")))))))
 
 
-(defun chess-puzzle-handler (game display event &rest args)
+(defun chess-puzzle-handler (game display event &rest _args)
   (if (and (eq event 'move)
           (chess-game-over-p game))
       (with-current-buffer display
index de353c6bb26761f188091a0c1a209299eb2b6e89..8397c79fa45d5fbf1e6370cfc77472057d983178 100644 (file)
@@ -1,6 +1,6 @@
 ;;; chess-sound.el --- Announce chess moves with pre-recorded sound files
 
-;; Copyright (C) 2002, 2008  Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2008, 2014  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 ;; Maintainer: Mario Lang <mlang@delysid.org>
@@ -73,7 +73,7 @@
   (apply 'call-process chess-sound-program
         nil nil nil (append chess-sound-args (list file))))
 
-(defun chess-sound-handler (game event &rest args)
+(defun chess-sound-handler (game event &rest _args)
   (cond
    ((eq event 'initialize)
     (and (file-directory-p chess-sound-directory)
@@ -94,8 +94,7 @@
               (target (chess-ply-target ply))
               (s-piece (and source (chess-pos-piece pos source)))
               (t-piece (and target (chess-pos-piece pos target)))
-              (which (chess-ply-keyword ply :which))
-              text)
+              (which (chess-ply-keyword ply :which)))
          (cond
           ((chess-ply-keyword ply :castle)
            (chess-sound "O-O"))
index ddd4a64b6b72527eb3e4b20e72816c3b63df5b3c..55d951d0cd2ccb4d156e0b0701bd7cb5def9f6cc 100644 (file)
@@ -21,8 +21,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'chess-database)
 (require 'chess-game)
index 3f3d885e8c79f41bd0e15f4fdbe5bdbfb912bfaf..d7d3cc46f60938341e1ade07bc46bfd2f7cab8e4 100644 (file)
@@ -38,7 +38,7 @@
     (knight-1-done    . "Goal: take all the pawns, without letting the queen take your knight")
     (cannot-take-queen . "You cannot take the queen")))
 
-(defun chess-tutorial-knight-1 (game ignore event &rest args)
+(defun chess-tutorial-knight-1 (game _ignore event &rest _args)
   (if (eq event 'move)
       (let ((position (chess-game-pos game)))
        (if (null (chess-pos-search position ?p))
index a546563aa0ed1b5a7658079e03a1b67ad800dd33..c69e00ca8f9a754ad8ce7921e920aaed205e9d03 100644 (file)
@@ -23,7 +23,7 @@
 ;;; Code:
 
 (require 'chess-ply)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defsubst chess-var-plies (var)
   "Return the plies of VAR."