emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 01/01: Don't require `cl'. Miscellaneous cleanups from compiler w


From: Stefan Monnier
Subject: [elpa] 01/01: Don't require `cl'. Miscellaneous cleanups from compiler warnings. * .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'.
Date: Sat, 24 May 2014 20:32:05 +0000

monnier pushed a commit to branch externals/chess
in repository elpa.

commit d3cd7181e95791923e04bb475a158500dadc816d
Author: Stefan Monnier <address@hidden>
Date:   Sat May 24 16:31:54 2014 -0400

    Don't require `cl'.  Miscellaneous cleanups from compiler warnings.
    * .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'.
---
 .gitignore         |    2 +
 chess-algebraic.el |    3 +-
 chess-autosave.el  |    6 ++--
 chess-chat.el      |    2 +-
 chess-crafty.el    |    1 -
 chess-display.el   |   78 ++++++++++++++++++++++++++--------------------------
 chess-eco.el       |    7 +---
 chess-engine.el    |    6 ++-
 chess-game.el      |    3 +-
 chess-ics.el       |    3 +-
 chess-ics1.el      |    4 +-
 chess-images.el    |   11 +------
 chess-kibitz.el    |    2 +
 chess-module.el    |    5 +--
 chess-pgn.el       |   27 ++++++++----------
 chess-plain.el     |    2 +-
 chess-ply.el       |   17 ++--------
 chess-polyglot.el  |    6 +--
 chess-pos.el       |   16 ++++------
 chess-puzzle.el    |    8 +++--
 chess-sound.el     |    7 ++--
 chess-test.el      |    3 +-
 chess-tutorial.el  |    2 +-
 chess-var.el       |    2 +-
 24 files changed, 98 insertions(+), 125 deletions(-)

diff --git a/.gitignore b/.gitignore
index 069edea..9c1720e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,8 @@
 /TAGS
 /auto-autoloads.el
 /chess-auto.el
+/chess-autoloads.el
+/chess-pkg.el
 /chess-test
 /config.log
 /config.status
diff --git a/chess-algebraic.el b/chess-algebraic.el
index 4a5e11c..c0d4038 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -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))
diff --git a/chess-autosave.el b/chess-autosave.el
index 2708d24..aa8661f 100644
--- a/chess-autosave.el
+++ b/chess-autosave.el
@@ -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)))
diff --git a/chess-chat.el b/chess-chat.el
index 339a73d..7dec279 100644
--- a/chess-chat.el
+++ b/chess-chat.el
@@ -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))
diff --git a/chess-crafty.el b/chess-crafty.el
index 53ff416..ea78090 100644
--- a/chess-crafty.el
+++ b/chess-crafty.el
@@ -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)
diff --git a/chess-display.el b/chess-display.el
index a83d95e..45e54aa 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -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))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/chess-eco.el b/chess-eco.el
index a1a969c..d3ffff0 100644
--- a/chess-eco.el
+++ b/chess-eco.el
@@ -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 <address@hidden>
 ;; 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
diff --git a/chess-engine.el b/chess-engine.el
index fe3122f..0fef4b0 100644
--- a/chess-engine.el
+++ b/chess-engine.el
@@ -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)
diff --git a/chess-game.el b/chess-game.el
index 334ec70..aace91b 100644
--- a/chess-game.el
+++ b/chess-game.el
@@ -26,8 +26,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'chess-ply)
 (require 'chess-pgn)
 
diff --git a/chess-ics.el b/chess-ics.el
index 13f40c3..265a7b1 100644
--- a/chess-ics.el
+++ b/chess-ics.el
@@ -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)))
diff --git a/chess-ics1.el b/chess-ics1.el
index 714b545..ec0c3ed 100644
--- a/chess-ics1.el
+++ b/chess-ics1.el
@@ -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 <address@hidden>
 ;; 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))
diff --git a/chess-images.el b/chess-images.el
index 79f7baa..9b45593 100644
--- a/chess-images.el
+++ b/chess-images.el
@@ -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)
diff --git a/chess-kibitz.el b/chess-kibitz.el
index ff02265..7fbcaab 100644
--- a/chess-kibitz.el
+++ b/chess-kibitz.el
@@ -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
diff --git a/chess-module.el b/chess-module.el
index 01feffc..c581844 100644
--- a/chess-module.el
+++ b/chess-module.el
@@ -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))
diff --git a/chess-pgn.el b/chess-pgn.el
index 7b8322f..14cec7a 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -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
diff --git a/chess-plain.el b/chess-plain.el
index 8517094..7dd66f1 100644
--- a/chess-plain.el
+++ b/chess-plain.el
@@ -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))
diff --git a/chess-ply.el b/chess-ply.el
index 726b2e7..036ff96 100644
--- a/chess-ply.el
+++ b/chess-ply.el
@@ -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
diff --git a/chess-polyglot.el b/chess-polyglot.el
index 7c11dd1..f1e5d44 100644
--- a/chess-polyglot.el
+++ b/chess-polyglot.el
@@ -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
diff --git a/chess-pos.el b/chess-pos.el
index c205069..11a2866 100644
--- a/chess-pos.el
+++ b/chess-pos.el
@@ -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
diff --git a/chess-puzzle.el b/chess-puzzle.el
index 216aa30..d41e6a5 100644
--- a/chess-puzzle.el
+++ b/chess-puzzle.el
@@ -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 <address@hidden>
 ;; Maintainer: Mario Lang <address@hidden>
@@ -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
diff --git a/chess-sound.el b/chess-sound.el
index de353c6..8397c79 100644
--- a/chess-sound.el
+++ b/chess-sound.el
@@ -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 <address@hidden>
 ;; Maintainer: Mario Lang <address@hidden>
@@ -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"))
diff --git a/chess-test.el b/chess-test.el
index ddd4a64..55d951d 100644
--- a/chess-test.el
+++ b/chess-test.el
@@ -21,8 +21,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'chess-database)
 (require 'chess-game)
diff --git a/chess-tutorial.el b/chess-tutorial.el
index 3f3d885..d7d3cc4 100644
--- a/chess-tutorial.el
+++ b/chess-tutorial.el
@@ -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))
diff --git a/chess-var.el b/chess-var.el
index a546563..c69e00c 100644
--- a/chess-var.el
+++ b/chess-var.el
@@ -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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]