branch: externals/chess commit 324ff9d1a095b2768f8566e765cbd778544ad3e6 Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
Enable lexical scoping Set lexical-binding is all files. Fix corresponding warnings. Remove redundant :group args. * chess-common.el (chess-with-temp-file): Use `declare`. * chess-display.el (chess-display-kill-board, chess-display-yank-board): obey the user's wishes w.r.t `x-select-enable-clipboard`. Merge code common to two `if` branches. (event-point): Don't define. (chess-display-mouse-set-piece): Test `xemacs` feature. * chess-game.el (chess-game-move): Move let-binding to inside the `cl-assert` so it doesn't signal a warning when the assert is removed. * chess-ics.el (chess-ics-matcher-alist, chess-ics): Don't use `setq` on `comint-preoutput-filter-functions`. (comint-preoutput-filter-functions): Don't force it to buffer-local. * chess-module.el (chess-with-current-buffer): Use `declare`. * chess-pgn.el (chess-pgn-mouse-show-position): Test `xemacs` feature. * chess-plain.el (chess-plain-draw): Use \s instead of a SPC char. * chess-ply.el (chess-ply): Define as a type. * chess-uci.el, chess-sjeng.el: Require `chess`. * chess.el (font-lock-add-keywords): Don't highlight `chess-with-current-buffer` specially since it's already done by default nowadays. --- chess-ai.el | 16 +++----------- chess-algebraic.el | 6 +++--- chess-announce.el | 4 ++-- chess-autosave.el | 14 ++++++------ chess-chat.el | 4 ++-- chess-clock.el | 4 ++-- chess-common.el | 9 ++++---- chess-crafty.el | 11 +++++----- chess-database.el | 15 ++++++------- chess-display.el | 62 ++++++++++++++++++++++-------------------------------- chess-eco.el | 9 ++++---- chess-engine.el | 6 +++--- chess-epd.el | 4 ++-- chess-fen.el | 4 ++-- chess-file.el | 6 +++--- chess-fruit.el | 11 +++++----- chess-game.el | 7 +++--- chess-german.el | 4 ++-- chess-glaurung.el | 11 +++++----- chess-gnuchess.el | 11 +++++----- chess-ics.el | 40 +++++++++++++++-------------------- chess-ics1.el | 27 ++++++++++-------------- chess-images.el | 57 +++++++++++++++++++------------------------------ chess-input.el | 5 ++--- chess-irc.el | 16 ++++++-------- chess-kibitz.el | 4 ++-- chess-link.el | 11 +++++----- chess-log.el | 6 +++--- chess-message.el | 13 ++++++------ chess-module.el | 16 +++++++------- chess-network.el | 4 ++-- chess-none.el | 4 ++-- chess-perft.el | 2 +- chess-pgn.el | 18 ++++++++-------- chess-phalanx.el | 9 ++++---- chess-plain.el | 35 +++++++++++------------------- chess-ply.el | 9 ++++---- chess-polyglot.el | 6 ++---- chess-pos.el | 2 +- chess-puzzle.el | 11 +++++----- chess-random.el | 4 ++-- chess-scid.el | 4 ++-- chess-sjeng.el | 12 +++++------ chess-sound.el | 27 ++++++++++-------------- chess-stockfish.el | 11 +++++----- chess-test.el | 4 ++-- chess-transport.el | 6 +++--- chess-tutorial.el | 6 +++--- chess-ucb.el | 9 ++++---- chess-uci.el | 5 +++-- chess-var.el | 4 ++-- chess.el | 23 ++++++++------------ 52 files changed, 273 insertions(+), 355 deletions(-) diff --git a/chess-ai.el b/chess-ai.el index 75e5047..dc1e0df 100644 --- a/chess-ai.el +++ b/chess-ai.el @@ -1,6 +1,6 @@ -;;; chess-ai.el --- A native Emacs Lisp Chess playing module +;;; chess-ai.el --- A native Emacs Lisp Chess playing module -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; Author: Mario Lang <ml...@delysid.org> @@ -50,52 +50,42 @@ reply moves. You can only specify the search depth (see `chess-ai-depth')." If `chess-ai-quiescence' is non-nil, quiescence search will be performed after this ply depth limit has been reached." - :group 'chess-ai :type 'integer) (defcustom chess-ai-quiescence-depth 2 "Search depth for quiescence search." - :group 'chess-ai :type 'integer) (defcustom chess-ai-pawn-value 100 "Value of a Pawn." - :group 'chess-ai :type 'integer) (defcustom chess-ai-knight-value 300 "Value of a Knight." - :group 'chess-ai :type 'integer) (defcustom chess-ai-bishop-value 300 "Value of a Bishop." - :group 'chess-ai :type 'integer) (defcustom chess-ai-rook-value 500 "Value of a Rook." - :group 'chess-ai :type 'intger) (defcustom chess-ai-queen-value 900 "Value of a Queen." - :group 'chess-ai :type 'integer) (defcustom chess-ai-passed-pawn 50 "Extra score for a passed Pawn." - :group 'chess-ai :type 'integer) (defcustom chess-ai-mobility t "Non-nil if piece mobility should be considered during static evaluation." - :group 'chess-ai :type 'boolean) (defcustom chess-ai-quiescence t "Non-nil if quiescence search should be performed." - :group 'chess-ai :type 'boolean) ;;;; Static evaluation @@ -335,7 +325,7 @@ DEPTH defaults to the value of `chess-ai-depth'." position)) (chess-ai-best-move position)))))) - (t (apply 'chess-common-handler game event args))))) + (t (apply #'chess-common-handler game event args))))) (provide 'chess-ai) ;;; chess-ai.el ends here diff --git a/chess-algebraic.el b/chess-algebraic.el index 3a07310..8db57a8 100644 --- a/chess-algebraic.el +++ b/chess-algebraic.el @@ -1,6 +1,6 @@ -;;; chess-algebraic.el --- Convert a ply to/from standard chess algebraic notation +;;; chess-algebraic.el --- Convert a ply to/from standard chess algebraic notation -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2008, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -171,7 +171,7 @@ This regexp matches short, long and figurine notation.") (nconc changes (list type move))) (condition-case err - (apply 'chess-ply-create position trust changes) + (apply #'chess-ply-create position trust changes) (error (chess-error 'at-move-string move (error-message-string err))))))))) diff --git a/chess-announce.el b/chess-announce.el index 36803f8..3d6ef3b 100644 --- a/chess-announce.el +++ b/chess-announce.el @@ -1,6 +1,6 @@ -;;; chess-announce.el --- Scheme to verbally announce chess moves +;;; chess-announce.el --- Scheme to verbally announce chess moves -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> diff --git a/chess-autosave.el b/chess-autosave.el index aa8661f..f41cbfc 100644 --- a/chess-autosave.el +++ b/chess-autosave.el @@ -1,6 +1,6 @@ -;;; chess-autosave.el --- A special kind of display that merely autosaves the game +;;; chess-autosave.el --- A special kind of display that merely autosaves the game -*- lexical-binding: t; -*- ;; -;; Copyright (C) 2002, 2004, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -32,8 +32,7 @@ (defcustom chess-autosave-file "~/.chess-save" "Filename in which to autosave chess games." - :type '(choice file (const :tag "Do not auto-save" nil)) - :group 'chess-autosave) + :type '(choice file (const :tag "Do not auto-save" nil))) (defcustom chess-autosave-database nil "If non-nil, a chess database file in which completed games are appended. @@ -42,8 +41,7 @@ work of saving the game object to whichever database(s) it chooses. Whether it closes those databases or caches them for later use is up to the user." :type '(choice (const :tag "Do not save completed games" nil) - file function) - :group 'chess-autosave) + file function)) (chess-message-catalog 'english '((chess-read-autosave . "There is a chess autosave file, read it? ") @@ -115,7 +113,7 @@ to the user." (setq changes (cdr changes))))) (insert ")")) -(defun chess-autosave-write (game file) +(defun chess-autosave-write (game _file) "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))) @@ -135,7 +133,7 @@ to the user." (basic-save-buffer) (message nil))) -(defun chess-autosave-read (game file) +(defun chess-autosave-read (game _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))) diff --git a/chess-chat.el b/chess-chat.el index 7dec279..d2489e0 100644 --- a/chess-chat.el +++ b/chess-chat.el @@ -1,6 +1,6 @@ -;;; chess-chat.el --- Very much like kibitzing, but not saved. +;;; chess-chat.el --- Very much like kibitzing, but not saved. -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> diff --git a/chess-clock.el b/chess-clock.el index c7b4d95..2fe7167 100644 --- a/chess-clock.el +++ b/chess-clock.el @@ -1,6 +1,6 @@ -;;; chess-clock.el --- Implements a chess clock +;;; chess-clock.el --- Implements a chess clock -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> diff --git a/chess-common.el b/chess-common.el index a574288..3e1dd35 100644 --- a/chess-common.el +++ b/chess-common.el @@ -1,6 +1,6 @@ -;;; chess-common.el --- Handler functions common to xboard based engine protocols +;;; chess-common.el --- Handler functions common to xboard based engine protocols -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -40,14 +40,13 @@ (make-variable-buffer-local 'chess-common-temp-files) (defmacro chess-with-temp-file (&rest body) + (declare (indent 1) (debug t)) `(let ((file (make-temp-file "chess"))) (with-temp-file file ,@body) (push file chess-common-temp-files) file)) -(put 'chess-with-temp-file 'lisp-indent-function 1) - (chess-message-catalog 'english '((starting-engine . "Starting chess program '%s'...") (starting-engine-done . "Starting chess program '%s'...done") @@ -106,7 +105,7 @@ (chess-error 'not-yet-implemented)) ((eq event 'undo) - (dotimes (i (car args)) + (dotimes (_ (car args)) (chess-engine-send nil "undo\n")) (if (= 1 (mod (car args) 2)) (chess-engine-send nil "go\n")) diff --git a/chess-crafty.el b/chess-crafty.el index 3335f8e..052dd7a 100644 --- a/chess-crafty.el +++ b/chess-crafty.el @@ -1,6 +1,6 @@ -;;; chess-crafty.el --- Play against crafty! +;;; chess-crafty.el --- Play against crafty! -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -33,9 +33,8 @@ (defcustom chess-crafty-path (or (executable-find "crafty") (executable-find "wcrafty")) - "*The path to the crafty executable." - :type 'file - :group 'chess-crafty) + "The path to the crafty executable." + :type 'file) (defvar chess-crafty-evaluation nil) @@ -176,7 +175,7 @@ (= 1 (mod (car args) 2))) (error "Cannot undo until after crafty moves")) - (apply 'chess-common-handler game event args))))) + (apply #'chess-common-handler game event args))))) (provide 'chess-crafty) diff --git a/chess-database.el b/chess-database.el index 0e29593..3a9748b 100644 --- a/chess-database.el +++ b/chess-database.el @@ -1,6 +1,6 @@ -;;; chess-database.el --- Basic code for manipulating game databases +;;; chess-database.el --- Basic code for manipulating game databases -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2008 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -29,8 +29,7 @@ (defcustom chess-database-modules '(chess-scid chess-file) "List of database modules to try when `chess-database-open' is called." - :type '(repeat (symbol :tag "Module")) - :group 'chess-database) + :type '(repeat (symbol :tag "Module"))) (defvar chess-database-handler nil) @@ -50,8 +49,8 @@ (when buffer (with-current-buffer buffer (setq chess-database-handler handler) - (add-hook 'kill-buffer-hook 'chess-database-close nil t) - (add-hook 'after-revert-hook 'chess-database-rescan nil t) + (add-hook 'kill-buffer-hook #'chess-database-close nil t) + (add-hook 'after-revert-hook #'chess-database-rescan nil t) (current-buffer))))))) (defun chess-database-open (file &optional module) @@ -74,7 +73,7 @@ (let ((buf (or database (current-buffer)))) (when (buffer-live-p buf) (with-current-buffer buf - (remove-hook 'kill-buffer-hook 'chess-database-close t)) + (remove-hook 'kill-buffer-hook #'chess-database-close t)) (chess-database-save buf) (chess-database-command buf 'close) (kill-buffer buf)))) @@ -111,7 +110,7 @@ TERMS is partly dependent on the chess-database module in use. chess-scid: tree-search GAME: Perform a tree search on the last position of GAME." - (apply 'chess-database-command database 'query terms)) + (apply #'chess-database-command database 'query terms)) (provide 'chess-database) diff --git a/chess-display.el b/chess-display.el index 8820383..0a84912 100644 --- a/chess-display.el +++ b/chess-display.el @@ -1,6 +1,6 @@ -;;; chess-display.el --- Code shared by all chess displays +;;; chess-display.el --- Code shared by all chess displays -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2005, 2008, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -40,20 +40,17 @@ (defcustom chess-display-popup t "If non-nil (the default), popup displays whenever a significant event occurs." - :type 'boolean - :group 'chess-display) + :type 'boolean) (make-variable-buffer-local 'chess-display-popup) (defcustom chess-display-highlight-legal t "If non-nil, highlight legal target squares when a piece is selected." - :type 'boolean - :group 'chess-display) + :type 'boolean) (defcustom chess-display-highlight-last-move nil "If non-nil, highlight the last move made on the game." - :type 'boolean - :group 'chess-display) + :type 'boolean) (chess-message-catalog 'english '((mode-white . "White") @@ -79,18 +76,15 @@ occurs." (concat " " (match-string 1 date))))) ")") "The format of a chess display's modeline. See `mode-line-format' for syntax details." - :type 'sexp - :group 'chess-display) + :type 'sexp) (defface chess-display-black-face '((t (:background "Black" :foreground "White"))) - "*The face used for the word Black in the mode-line." - :group 'chess-display) + "The face used for the word Black in the mode-line.") (defface chess-display-white-face '((t (:background "White" :foreground "Black"))) - "*The face used for the word White in the mode-line." - :group 'chess-display) + "The face used for the word White in the mode-line.") ;;; Code: @@ -525,16 +519,14 @@ that is supported by most displays, and is the default mode." (defcustom chess-display-interesting-events '(set-index) "Events which will cause a display refresh." - :type '(repeat symbol) - :group 'chess-display) + :type '(repeat symbol)) (defcustom chess-display-momentous-events '(orient post-undo setup-game pass move resign abort) "Events that will refresh, and cause 'main' displays to popup. These are displays for which `chess-display-set-main' has been called." - :type '(repeat symbol) - :group 'chess-display) + :type '(repeat symbol)) (defun chess-display-handler (game event &rest args) "This display module presents a standard chessboard. @@ -706,7 +698,7 @@ The key bindings available in this mode are: (function (lambda () (chess-display-position nil)))) - (setq chess-input-move-function 'chess-display-move)) + (setq chess-input-move-function #'chess-display-move)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; @@ -728,20 +720,21 @@ The key bindings available in this mode are: (defun chess-display-kill-board (&optional arg) "Send the current board configuration to the user." (interactive "P") - (let ((x-select-enable-clipboard t) + (let (;; (x-select-enable-clipboard t) ;; It's already the default! (game chess-module-game)) - (if arg - (kill-new (with-temp-buffer - (chess-game-to-pgn game) - (buffer-string))) - (kill-new (chess-pos-to-fen (chess-display-position nil) t))))) + (kill-new + (if arg + (with-temp-buffer + (chess-game-to-pgn game) + (buffer-string)) + (chess-pos-to-fen (chess-display-position nil) t))))) (declare-function chess-pgn-to-game "chess-pgn" (&optional string)) (defun chess-display-yank-board () "Send the current board configuration to the user." (interactive) - (let ((x-select-enable-clipboard t) + (let (;; (x-select-enable-clipboard t) ;; It's already the default! (display (current-buffer)) (text (current-kill 0))) (with-temp-buffer @@ -754,14 +747,12 @@ The key bindings available in this mode are: ((search-forward "[Event " nil t) (goto-char (match-beginning 0)) (chess-game-copy-game display (chess-pgn-to-game))) - ((looking-at (concat chess-algebraic-regexp "$")) - (let ((move (buffer-string))) - (with-current-buffer display - (chess-display-manual-move move)))) (t - (let ((fen (buffer-string))) + (let ((f (if (looking-at (concat chess-algebraic-regexp "$")) + #'chess-display-manual-move #'chess-display-set-from-fen)) + (str (buffer-string))) (with-current-buffer display - (chess-display-set-from-fen fen)))))))) + (funcall f str)))))))) (defvar chess-display-search-map (let ((map (copy-keymap minibuffer-local-map))) @@ -994,7 +985,7 @@ The key bindings available in this mode are: (ding))) (defun chess-display-list-buffers () - "List all buffders related to this display's current game." + "List all buffers related to this display's current game." (interactive) (let ((chess-game chess-module-game) (lb-command (lookup-key ctl-x-map [(control ?b)]))) @@ -1147,13 +1138,10 @@ to the end or beginning." (chess-display-draw-square nil index (or piece last-command-event) (point))))) -(unless (fboundp 'event-window) - (defalias 'event-point 'ignore)) - (defun chess-display-mouse-set-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)))) diff --git a/chess-eco.el b/chess-eco.el index 7485650..78d8aae 100644 --- a/chess-eco.el +++ b/chess-eco.el @@ -1,6 +1,6 @@ -;;; chess-eco.el --- Chess opening classification +;;; chess-eco.el --- Chess opening classification -*- lexical-binding: t; -*- -;; Copyright (C) 2004, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2004-2020 Free Software Foundation, Inc. ;; Author: Mario Lang <ml...@delysid.org> ;; Keywords: games @@ -31,8 +31,7 @@ :group 'chess) (defcustom chess-eco-max-index 36 - "*Index at which to stop chess opening announcements." - :group 'chess-eco + "Index at which to stop chess opening announcements." :type 'integer) (defvar chess-eco-hash-table @@ -69,7 +68,7 @@ (car entry) (cadr entry)) (let ((pos (chess-pos-create))) (mapc (lambda (move) - (apply 'chess-pos-move + (apply #'chess-pos-move pos (chess-ply-changes (chess-algebraic-to-ply pos move)))) (split-string (car (cddr entry)) " " t)) diff --git a/chess-engine.el b/chess-engine.el index a825a61..c3e0969 100644 --- a/chess-engine.el +++ b/chess-engine.el @@ -1,6 +1,6 @@ -;;; chess-engine.el --- Obtain movements and other information from an engine +;;; chess-engine.el --- Obtain movements and other information from an engine -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free @@ -310,7 +310,7 @@ If conversion fails, this function fired an 'illegal event." &rest handler-ctor-args) "Create a new chess engine MODULE (a symbol) associated with GAME. Optionally supply a new RESPONSE-HANDLER." - (let* ((engine (apply 'chess-module-create module game nil + (let* ((engine (apply #'chess-module-create module game nil handler-ctor-args))) (when engine (with-current-buffer engine diff --git a/chess-epd.el b/chess-epd.el index 1c4a643..c956647 100644 --- a/chess-epd.el +++ b/chess-epd.el @@ -1,6 +1,6 @@ -;;; chess-epd.el --- Extended Position Description Format +;;; chess-epd.el --- Extended Position Description Format -*- lexical-binding: t; -*- -;; Copyright (C) 2004 Free Software Foundation, Inc. +;; Copyright (C) 2004-2020 Free Software Foundation, Inc. ;; Author: Mario Lang <ml...@delysid.org> diff --git a/chess-fen.el b/chess-fen.el index 52bdf9e..675a03d 100644 --- a/chess-fen.el +++ b/chess-fen.el @@ -1,6 +1,6 @@ -;;; chess-fen.el --- Convert a chess position to/from FEN notation +;;; chess-fen.el --- Convert a chess position to/from FEN notation -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> diff --git a/chess-file.el b/chess-file.el index 95a5e9e..585ef7b 100644 --- a/chess-file.el +++ b/chess-file.el @@ -1,6 +1,6 @@ -;;; chess-file.el --- Handle chess databases stored in PGN or EPD files +;;; chess-file.el --- Handle chess databases stored in PGN or EPD files -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -106,7 +106,7 @@ inbetween of individual records.") (goto-char (point-max)) (while (memq (char-before) '(? ?\t ?\n ?\r)) (delete-char -1)) - (apply 'insert (nth 4 (assq chess-file-type chess-file-types))) + (apply #'insert (nth 4 (assq chess-file-type chess-file-types))) (push (point) chess-file-locations) (funcall (nth 3 (assq chess-file-type chess-file-types)) (car args)) (1- (chess-file-handler 'count))) diff --git a/chess-fruit.el b/chess-fruit.el index 4794817..01181a1 100644 --- a/chess-fruit.el +++ b/chess-fruit.el @@ -1,6 +1,6 @@ -;;; chess-fruit.el --- Play against fruit! +;;; chess-fruit.el --- Play against fruit! -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; Author: Mario Lang <ml...@delysid.org> ;; Keywords: games, processes @@ -28,9 +28,8 @@ :link '(url-link "http://www.fruitchess.com/";)) (defcustom chess-fruit-path (executable-find "fruit") - "*The path to the fruit executable." - :type 'file - :group 'chess-fruit) + "The path to the fruit executable." + :type 'file) (defvar chess-fruit-regexp-alist chess-uci-regexp-alist "Patterns used to match engine output.") @@ -50,7 +49,7 @@ (= 1 (mod (car args) 2))) (error "Cannot undo until after fruit moves")) - (apply 'chess-uci-handler game event args))))) + (apply #'chess-uci-handler game event args))))) (provide 'chess-fruit) diff --git a/chess-game.el b/chess-game.el index c0b6079..5616048 100644 --- a/chess-game.el +++ b/chess-game.el @@ -1,4 +1,4 @@ -;;; chess-game.el --- Maintain a chess game that is being played or viewed +;;; chess-game.el --- Maintain a chess game that is being played or viewed -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2020 Free Software Foundation, Inc. @@ -295,11 +295,12 @@ progress (nil), if it is drawn, resigned, mate, etc." (cl-assert game) (cl-assert (listp ply)) (let ((current-ply (chess-game-ply game)) - (position (chess-ply-pos ply)) (changes (chess-ply-changes ply))) (cl-assert current-ply) - (cl-assert (and position (eq position (chess-ply-pos current-ply)))) + (cl-assert + (let ((position (chess-ply-pos ply))) + (and position (eq position (chess-ply-pos current-ply))))) (cl-assert changes) (if (chess-ply-final-p current-ply) diff --git a/chess-german.el b/chess-german.el index 881ddaa..54e87d5 100644 --- a/chess-german.el +++ b/chess-german.el @@ -1,6 +1,6 @@ -;;; chess-german.el --- German translation of the chess.el message catalog +;;; chess-german.el --- German translation of the chess.el message catalog -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; Author: Mario Lang <ml...@delysid.org> ;; Keywords: games, i18n diff --git a/chess-glaurung.el b/chess-glaurung.el index 04e5c3f..b842bd5 100644 --- a/chess-glaurung.el +++ b/chess-glaurung.el @@ -1,6 +1,6 @@ -;;; chess-glaurung.el --- Play against glaurung! +;;; chess-glaurung.el --- Play against glaurung! -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; Author: Mario Lang <ml...@delysid.org> ;; Keywords: games, processes @@ -29,9 +29,8 @@ :link '(url-link "http://www.glaurungchess.com/";)) (defcustom chess-glaurung-path (executable-find "glaurung") - "*The path to the glaurung executable." - :type 'file - :group 'chess-glaurung) + "The path to the glaurung executable." + :type 'file) (defvar chess-glaurung-regexp-alist chess-uci-regexp-alist "Patterns used to match engine output.") @@ -51,7 +50,7 @@ (= 1 (mod (car args) 2))) (error "Cannot undo until after glaurung moves")) - (apply 'chess-uci-handler game event args))))) + (apply #'chess-uci-handler game event args))))) (provide 'chess-glaurung) diff --git a/chess-gnuchess.el b/chess-gnuchess.el index db23b19..decb3aa 100644 --- a/chess-gnuchess.el +++ b/chess-gnuchess.el @@ -1,6 +1,6 @@ -;;; chess-gnuchess.el --- Play against gnuchess! +;;; chess-gnuchess.el --- Play against gnuchess! -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -33,9 +33,8 @@ (defcustom chess-gnuchess-path (let ((exec-path (cons "/usr/games" exec-path))) (executable-find "gnuchess")) - "*The path to the gnuchess executable." - :type 'file - :group 'chess-gnuchess) + "The path to the gnuchess executable." + :type 'file) (defvar chess-gnuchess-bad-board nil) (make-variable-buffer-local 'chess-gnuchess-bad-board) @@ -98,7 +97,7 @@ (setq chess-gnuchess-bad-board nil))) (t - (apply 'chess-common-handler game event args))))) + (apply #'chess-common-handler game event args))))) (provide 'chess-gnuchess) diff --git a/chess-ics.el b/chess-ics.el index ca2aaab..2d53bec 100644 --- a/chess-ics.el +++ b/chess-ics.el @@ -1,6 +1,6 @@ -;;; chess-ics.el --- Play on Internet Chess Servers +;;; chess-ics.el --- Play on Internet Chess Servers -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2003, 2004, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -66,8 +66,7 @@ The format of each entry is: (choice (const :tag "Direct connection" nil) (file :tag "Command")) (choice (const :tag "No arguments" nil) - (repeat string)))) - :group 'chess-ics) + (repeat string))))) @@ -93,15 +92,13 @@ The format is (SERVER COMMANDS...) where SERVER is either the server-name \(see `chess-ics-server-list') or nil, which is the default to use for all servers which do not have a specialized entry in this list. COMMAND is a string which should be sent (newline characters will be added automatically.)" - :group 'chess-ics :type '(repeat (list :tag "Initialisation for" (choice (string :tag "Server Name") (const :tag "Default" nil)) (repeat :inline t (string :tag "Command"))))) (defcustom chess-ics-prompt-regexp "\\(?:[0-2][0-9]:[0-6][0-9]_\\)?[af]ics% $" - "*Regexp which matches an ICS prompt." - :group 'chess-ics + "Regexp which matches an ICS prompt." :type 'regexp) (defvar chess-ics-server nil @@ -127,8 +124,7 @@ and ICC.") (make-variable-buffer-local 'chess-ics-server-type) (defcustom chess-ics-icc-datagrams '(22 23 26 33 50 51 56 110 111) - "*A list of datagrams to request when connecting to ICC." - :group 'chess-ics + "A list of datagrams to request when connecting to ICC." :type '(repeat (choice (const :tag "DG_SEND_MOVES" 24) (const :tag "DG_KIBITZ" 26) (const :tag "DG_MOVE_ALGEBRAIC" 33) @@ -213,9 +209,9 @@ standard position). In those cases, this variable should be set to nil.") (function (lambda () (when chess-ics-handling-login - (setq chess-ics-server-type 'ICC - comint-preoutput-filter-functions - '(chess-icc-preoutput-filter))) + (setq chess-ics-server-type 'ICC) + (add-hook 'comint-preoutput-filter-functions + #'chess-icc-preoutput-filter nil t)) 'once))) (cons "\\(ogin\\|name\\):" (function @@ -224,7 +220,7 @@ standard position). In those cases, this variable should be set to nil.") (chess-ics-send (format "level2settings=%s" (let ((str (make-string - (1+ (apply 'max chess-ics-icc-datagrams)) + (1+ (apply #'max chess-ics-icc-datagrams)) ?0))) (dolist (dg chess-ics-icc-datagrams str) (aset str dg ?1)))))) @@ -260,7 +256,7 @@ standard position). In those cases, this variable should be set to nil.") (function (lambda () (chess-ics-send - (mapconcat 'identity + (mapconcat #'identity (cdr (or (assoc chess-ics-server chess-ics-initial-commands) @@ -682,17 +678,14 @@ See `chess-ics-game'.") (defcustom chess-ics-popup-sought t "If non-nil, display the sought buffer automatically." - :group 'chess-ics :type 'boolean) (defcustom chess-ics-sought-buffer-name "*chess-ics-sought*" "The name of the buffer which accumulates seek ads." - :group 'chess-ics :type 'string) (define-derived-mode chess-ics-ads-mode tabulated-list-mode "ICSAds" "Mode for displaying sought games from Internet Chess Servers." - :group 'chess-ics (setq tabulated-list-format [("Player" 20 t) ("Rating" 10 t :right-align t) ("Rated" 5 nil :right-align t) @@ -778,7 +771,8 @@ This function should be put on `comint-preoutput-filter-functions'." (tabulated-list-revert)))))))) string) -(make-variable-buffer-local 'comint-preoutput-filter-functions) +;; FIXME: This is evil! +;;(make-variable-buffer-local 'comint-preoutput-filter-functions) ;;;###autoload (defun chess-ics (server port &optional handle password-or-filename @@ -801,7 +795,7 @@ This function should be put on `comint-preoutput-filter-functions'." (setq handle "guest")) (chess-message 'ics-connecting server) (let ((buf (if helper - (apply 'make-comint "chess-ics" helper nil helper-args) + (apply #'make-comint "chess-ics" helper nil helper-args) (make-comint "chess-ics" (cons server port))))) (chess-message 'ics-connected server) (set-buffer buf) @@ -818,9 +812,9 @@ This function should be put on `comint-preoutput-filter-functions'." chess-engine-regexp-alist (copy-alist chess-ics-matcher-alist) comint-prompt-regexp "^[^%\n]*% *" comint-scroll-show-maximum-output t) - (add-hook 'comint-output-filter-functions 'chess-engine-filter t t) - (setq comint-preoutput-filter-functions - '(chess-ics-ads-removed chess-ics-seeking)) + (add-hook 'comint-output-filter-functions #'chess-engine-filter t t) + (add-hook 'comint-preoutput-filter-functions #'chess-ics-seeking nil t) + (add-hook 'comint-preoutput-filter-functions #'chess-ics-ads-removed nil t) (let ((ntimes 50)) (while (and chess-ics-handling-login (> (setq ntimes (1- ntimes)) 0)) @@ -1091,7 +1085,7 @@ This function should be put on `comint-preoutput-filter-functions'." (chess-ics-send "resign" (chess-game-data game 'ics-buffer))) (t - (apply 'chess-network-handler game event args))))) + (apply #'chess-network-handler game event args))))) (provide 'chess-ics) diff --git a/chess-ics1.el b/chess-ics1.el index 4be5e60..b985bfb 100644 --- a/chess-ics1.el +++ b/chess-ics1.el @@ -1,6 +1,6 @@ -;;; chess-ics1.el --- Classic ICS1 style chessboard display +;;; chess-ics1.el --- Classic ICS1 style chessboard display -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2005, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Keywords: games @@ -30,31 +30,26 @@ '((((class color) (background light)) (:foreground "Green")) (((class color) (background dark)) (:foreground "Green")) (t (:bold t))) - "*The face used for black pieces on the ASCII display." - :group 'chess-ics1) + "The face used for black pieces on the ASCII display.") (defface chess-ics1-white-face '((((class color) (background light)) (:foreground "Yellow")) (((class color) (background dark)) (:foreground "Yellow")) (t (:bold t))) - "*The face used for white pieces on the ASCII display." - :group 'chess-ics1) + "The face used for white pieces on the ASCII display.") (defface chess-ics1-highlight-face '((((class color) (background light)) (:background "#add8e6")) (((class color) (background dark)) (:background "#add8e6"))) - "Face to use for highlighting pieces that have been selected." - :group 'chess-ics1) + "Face to use for highlighting pieces that have been selected.") -(defcustom chess-ics1-popup-function 'chess-ics1-popup +(defcustom chess-ics1-popup-function #'chess-ics1-popup "The function used to popup a chess-ics1 display." - :type 'function - :group 'chess-ics1) + :type 'function) (defcustom chess-ics1-separate-frame nil "If non-nil, display the chessboard in its own frame." - :type 'boolean - :group 'chess-ics1) + :type 'boolean) ;;; Code: @@ -66,13 +61,13 @@ (funcall chess-ics1-popup-function)) ((eq event 'draw) - (apply 'chess-ics1-draw args)) + (apply #'chess-ics1-draw args)) ((eq event 'draw-square) - (apply 'chess-ics1-draw-square args)) + (apply #'chess-ics1-draw-square args)) ((eq event 'highlight) - (apply 'chess-ics1-highlight args)))) + (apply #'chess-ics1-highlight args)))) (defun chess-ics1-popup () (if chess-ics1-separate-frame diff --git a/chess-images.el b/chess-images.el index f2e0f03..f7abed0 100644 --- a/chess-images.el +++ b/chess-images.el @@ -1,6 +1,6 @@ -;;; chess-images.el --- Chessboard display style using graphical images +;;; chess-images.el --- Chessboard display style using graphical images -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2005, 2008, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Keywords: games @@ -54,8 +54,7 @@ (defcustom chess-images-separate-frame (display-multi-frame-p) "If non-nil, display the chessboard in its own frame." - :type 'boolean - :group 'chess-images) + :type 'boolean) (defcustom chess-images-directory (if (file-directory-p "/usr/share/games/xboard/pixmaps") @@ -83,8 +82,7 @@ for all squares. If you want really custom pieces, you can use the symbolic colors dark_square, light_square and dark_piece and light_piece." :type 'directory - :set 'chess-images-clear-image-cache - :group 'chess-images) + :set #'chess-images-clear-image-cache) (defcustom chess-images-default-size nil "The default pixel width to use for chess pieces. @@ -92,8 +90,7 @@ If this width is not available, then next smallest will be chosen. If there is none smaller, then the best size available will be chosen. If `chess-images-default-size' is nil (the default), then the best width for the current display is calculated used." - :type '(choice integer (const :tag "Best fit" nil)) - :group 'chess-images) + :type '(choice integer (const :tag "Best fit" nil))) (defcustom chess-images-background-image "blank" "The name of the file used for background squares. @@ -101,69 +98,59 @@ This file is optional. If there is no file available by this name, a solid color square will be created and used. This option exists so that specialized squares may be used such as marble tiles, etc." :type 'file - :set 'chess-images-clear-image-cache - :group 'chess-images) + :set #'chess-images-clear-image-cache) (defcustom chess-images-border-color (cdr (assq 'background-color (frame-parameters))) "Color to use for the border around pieces." :type 'color - :set 'chess-images-clear-image-cache - :group 'chess-images) + :set #'chess-images-clear-image-cache) (defcustom chess-images-dark-color (if (display-color-p) "#77a26d" "gray60") "Color to use for \"dark\" background squares." :type 'color - :set 'chess-images-clear-image-cache - :group 'chess-images) + :set #'chess-images-clear-image-cache) (defcustom chess-images-light-color (if (display-color-p) "#c8c365" "gray80") "Color to use for \"light\" background squares." :type 'color - :set 'chess-images-clear-image-cache - :group 'chess-images) + :set #'chess-images-clear-image-cache) (defcustom chess-images-black-color (if (display-color-p) "#202020" "gray0") "Color to use for \"black\" pieces." :type 'color - :set 'chess-images-clear-image-cache - :group 'chess-images) + :set #'chess-images-clear-image-cache) (defcustom chess-images-white-color (if (display-color-p) "#ffffcc" "gray100") "Color to use for \"white\" pieces." :type 'color - :set 'chess-images-clear-image-cache - :group 'chess-images) + :set #'chess-images-clear-image-cache) (defcustom chess-images-highlight-color (if (display-color-p) "#add8e6" "gray90") "Color to use for highlighting pieces that have been selected." :type 'color - :set 'chess-images-clear-image-cache - :group 'chess-images) + :set #'chess-images-clear-image-cache) (defcustom chess-images-extension "xpm" "The file extension used for chess display bitmaps." :type 'file - :set 'chess-images-clear-image-cache - :group 'chess-images) + :set #'chess-images-clear-image-cache) (defcustom chess-images-border-width 2 "This defines the width of the border that surrounds each piece." :type '(choice integer (const :tag "No border" nil)) - :set 'chess-images-clear-image-cache - :group 'chess-images) + :set #'chess-images-clear-image-cache) -(defcustom chess-images-popup-function 'chess-images-popup +(defcustom chess-images-popup-function #'chess-images-popup "The function used to popup a chess-images display. The current-buffer is set to the display buffer when this function is called." - :type 'function - :group 'chess-images) + :type 'function) ;;; Code: @@ -192,13 +179,13 @@ called." (funcall chess-images-popup-function)) ((eq event 'draw) - (apply 'chess-images-draw args)) + (apply #'chess-images-draw args)) ((eq event 'draw-square) - (apply 'chess-images-draw-square args)) + (apply #'chess-images-draw-square args)) ((eq event 'highlight) - (apply 'chess-images-highlight args)) + (apply #'chess-images-highlight args)) ((eq event 'start-edit) (setq cursor-type t)) @@ -419,7 +406,7 @@ They are returned in ascending order, or nil for no sizes available." (insert "\" c red s void\",\n") (insert "\". c red s background\",\n") (insert "/* pixels */\n") - (dotimes (i height) + (dotimes (_ height) (insert ?\" (make-string (or width height) ?.) ?\" ?, ?\n)) (delete-char -2) (insert "\n};\n") @@ -455,9 +442,9 @@ This is necessary for bizzare Emacs reasons." (forward-line (1+ colors)) (while (looking-at "/\\*") (forward-line)) - (dotimes (i add-height) + (dotimes (_ add-height) (insert "\"") - (dotimes (j width) + (dotimes (_ width) (insert color-char)) (insert "\",\n")))) (buffer-string))) diff --git a/chess-input.el b/chess-input.el index 4a43c7d..ba0a7a3 100644 --- a/chess-input.el +++ b/chess-input.el @@ -1,6 +1,6 @@ -;;; chess-input.el --- Keyboard entry of algebraic notation, using shortcut notation +;;; chess-input.el --- Keyboard entry of algebraic notation, using shortcut notation -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2005, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -54,7 +54,6 @@ (defcustom chess-input-notation-type :san "Define the notation type to use for move input." - :group 'chess-input :type '(choice (const :tag "Standard (short) algebraic notation" :san) (const :tag "Numeric notation" :numeric))) diff --git a/chess-irc.el b/chess-irc.el index d29e3d3..b52994c 100644 --- a/chess-irc.el +++ b/chess-irc.el @@ -1,6 +1,6 @@ -;;; chess-irc.el --- This transport uses an IRC bot to send/receive moves. +;;; chess-irc.el --- This transport uses an IRC bot to send/receive moves. -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free @@ -19,6 +19,7 @@ ;;; Code: +(require 'chess) ;For `chess-full-name' (require 'chess-network) (defgroup chess-irc nil @@ -27,18 +28,15 @@ (defcustom chess-irc-server "irc.openprojects.net" "The IRC host to connect your chess-irc engine to." - :type 'string - :group 'chess-irc) + :type 'string) (defcustom chess-irc-port 6667 "The port of the IRC host specified by `chess-irc-server'." - :type 'string - :group 'chess-irc) + :type 'string) (defcustom chess-irc-nick (user-login-name) "The nick you wish to use for sending/receiving IRC chess moves." - :type 'string - :group 'chess-irc) + :type 'string) ;;; Code: @@ -113,7 +111,7 @@ (format "PRIVMSG %s :%s\n" chess-irc-opponent (car args))))) (t - (apply 'chess-network-handler game event args))))) + (apply #'chess-network-handler game event args))))) ;; This filter translates IRC syntax into basic chess-network protocol (defun chess-irc-filter (proc string) diff --git a/chess-kibitz.el b/chess-kibitz.el index 7fbcaab..15b9243 100644 --- a/chess-kibitz.el +++ b/chess-kibitz.el @@ -1,6 +1,6 @@ -;;; chess-kibitz.el --- Chess kibitzing, stored as annotations +;;; chess-kibitz.el --- Chess kibitzing, stored as annotations -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> diff --git a/chess-link.el b/chess-link.el index afc5607..ebd1bfe 100644 --- a/chess-link.el +++ b/chess-link.el @@ -1,6 +1,6 @@ -;;; chess-link.el --- Connect two engines +;;; chess-link.el --- Connect two engines -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free @@ -42,13 +42,14 @@ (t (let ((chess-engine-inhibit-auto-pass t)) (setq return-value - (apply 'chess-engine-default-handler event args))) + (apply #'chess-engine-default-handler event args))) ;; but now transfer the event to the other engine - (apply 'chess-engine-command + (apply #'chess-engine-command (if (eq (current-buffer) first-engine) second-engine - first-engine) event args) + first-engine) + event args) return-value)))) diff --git a/chess-log.el b/chess-log.el index c13ff27..a2f3609 100644 --- a/chess-log.el +++ b/chess-log.el @@ -1,6 +1,6 @@ -;;; chess-log.el --- Log chess events, as an aid to debugging +;;; chess-log.el --- Log chess events, as an aid to debugging -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free @@ -27,7 +27,7 @@ (defun chess-log (&rest args) (with-current-buffer (get-buffer-create "*Chess Log*") - (insert (apply 'format args) ?\n))) + (insert (apply #'format args) ?\n))) (provide 'chess-log) diff --git a/chess-message.el b/chess-message.el index 42bdc75..98da7e1 100644 --- a/chess-message.el +++ b/chess-message.el @@ -1,6 +1,6 @@ -;;; chess-message.el --- Code shared by all chess displays +;;; chess-message.el --- Code shared by all chess displays -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free @@ -25,8 +25,7 @@ (defcustom chess-message-language 'english "The language to use when reporting messages." - :type 'symbol - :group 'chess-message) + :type 'symbol) ;;; Code: @@ -46,14 +45,14 @@ (let* ((entry (assq chess-message-language chess-message-catalog)) (msg (and entry (cdr (assq key (cdr entry)))))) (if msg - (apply 'format msg arguments) + (apply #'format msg arguments) (format "Message not found: %s" key)))) (defsubst chess-message (key &rest arguments) - (message (apply 'chess-string key arguments))) + (message (apply #'chess-string key arguments))) (defsubst chess-error (key &rest arguments) - (error (apply 'chess-string key arguments))) + (error (apply #'chess-string key arguments))) (put 'chess-message-catalog 'lisp-indent-function 1) diff --git a/chess-module.el b/chess-module.el index c581844..19df0be 100644 --- a/chess-module.el +++ b/chess-module.el @@ -1,6 +1,6 @@ -;;; chess-module.el --- Basic module support code underlying all chess.el modules +;;; chess-module.el --- Basic module support code underlying all chess.el modules -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2008, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Keywords: games @@ -36,14 +36,14 @@ '((no-such-module . "There is no module named '%s'"))) (defmacro chess-with-current-buffer (buffer &rest body) + ;; FIXME: Beware, this doubles the code size! + (declare (debug t) (indent 1)) `(let ((buf ,buffer)) (if buf (with-current-buffer buf ,@body) ,@body))) -(put 'chess-with-current-buffer 'lisp-indent-function 1) - (defun chess-module-create (derived game &optional buffer-name &rest ctor-args) (let* ((name (symbol-name derived)) @@ -56,7 +56,7 @@ (if (not (apply handler game 'initialize ctor-args)) (ignore (kill-buffer (current-buffer))) - (add-hook 'kill-buffer-hook 'chess-module-destroy nil t) + (add-hook 'kill-buffer-hook #'chess-module-destroy nil t) (setq chess-module-event-handler handler) (chess-module-set-game* nil game) (current-buffer))))) @@ -72,7 +72,7 @@ (defun chess-module-detach-game (module) (chess-with-current-buffer module (chess-game-remove-hook chess-module-game - 'chess-module-event-handler + #'chess-module-event-handler (or module (current-buffer))) ;; if we are the leader, shutdown the game we were attached to ;; previously @@ -90,7 +90,7 @@ (if chess-module-game (chess-module-detach-game nil)) (setq chess-module-game game) - (chess-game-add-hook game 'chess-module-event-handler + (chess-game-add-hook game #'chess-module-event-handler (or module (current-buffer))))) (defsubst chess-module-leader-p (module) @@ -109,7 +109,7 @@ (let ((buf (or module (current-buffer)))) (when (buffer-live-p buf) (with-current-buffer buf - (remove-hook 'kill-buffer-hook 'chess-module-destroy t) + (remove-hook 'kill-buffer-hook #'chess-module-destroy t) (chess-module-detach-game nil)) (kill-buffer buf)))) diff --git a/chess-network.el b/chess-network.el index 4d51666..6de694e 100644 --- a/chess-network.el +++ b/chess-network.el @@ -1,4 +1,4 @@ -;;; chess-network.el --- Play against an opponent over the network +;;; chess-network.el --- Play against an opponent over the network -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2020 Free Software Foundation, Inc. @@ -236,7 +236,7 @@ (chess-common-handler game 'flag-fell)) (t - (apply 'chess-common-handler game event args))))) + (apply #'chess-common-handler game event args))))) (provide 'chess-network) diff --git a/chess-none.el b/chess-none.el index 1d8977a..9af94dc 100644 --- a/chess-none.el +++ b/chess-none.el @@ -1,6 +1,6 @@ -;;; chess-none.el --- Null engine +;;; chess-none.el --- Null engine -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free diff --git a/chess-perft.el b/chess-perft.el index a24d584..71b6c56 100644 --- a/chess-perft.el +++ b/chess-perft.el @@ -1,6 +1,6 @@ ;;; chess-perft.el --- Perft tests for emacs-chess -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; Author: Mario Lang <ml...@delysid.org> ;; Keywords: games diff --git a/chess-pgn.el b/chess-pgn.el index 575e8fd..8021229 100644 --- a/chess-pgn.el +++ b/chess-pgn.el @@ -1,6 +1,6 @@ -;;; chess-pgn.el --- Convert a chess game to/from Portable Game Notation (PGN) +;;; chess-pgn.el --- Convert a chess game to/from Portable Game Notation (PGN) -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2008, 2014, 2017 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -181,7 +181,7 @@ Optionally use the supplied STRING instead of the current buffer." (chess-pgn-insert-plies game index ann)))) (defun chess-pgn-insert-plies (game index plies &optional - for-black indented no-annotations) + for-black _indented no-annotations) "NYI: Still have to implement INDENTED argument." (while plies (unless for-black @@ -232,7 +232,7 @@ PGN text." tags (cdr tags)))) index)) -(defun chess-insert-pgn (game &optional indented) +(defun chess-insert-pgn (game &optional _indented) (let ((fen (chess-game-tag game "FEN")) (first-pos (chess-game-pos game 0))) (when (and fen (not (string= fen (chess-pos-to-fen first-pos)))) @@ -323,11 +323,11 @@ PGN text." (if (fboundp 'font-lock-mode) (font-lock-mode 1)) (set (make-local-variable 'pcomplete-default-completion-function) - 'chess-pgn-completions) + #'chess-pgn-completions) (set (make-local-variable 'pcomplete-command-completion-function) - 'chess-pgn-completions) + #'chess-pgn-completions) (set (make-local-variable 'pcomplete-parse-arguments-function) - 'chess-pgn-current-word)) + #'chess-pgn-current-word)) ;;;###autoload (defalias 'pgn-mode 'chess-pgn-mode) @@ -362,7 +362,7 @@ PGN text." (let ((position (chess-game-pos chess-pgn-current-game chess-pgn-current-index))) (while (pcomplete-here - (mapcar 'chess-ply-to-algebraic + (mapcar #'chess-ply-to-algebraic (chess-legal-plies position :color (chess-pos-side-to-move position))))))) @@ -469,7 +469,7 @@ This does not require that the buffer be in PGN mode." (defun chess-pgn-mouse-show-position (event) (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)))) diff --git a/chess-phalanx.el b/chess-phalanx.el index 5d39b28..82e4ef5 100644 --- a/chess-phalanx.el +++ b/chess-phalanx.el @@ -1,6 +1,6 @@ -;;; chess-phalanx.el --- Play chess against phalanx! +;;; chess-phalanx.el --- Play chess against phalanx! -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -30,8 +30,7 @@ (defcustom chess-phalanx-path (executable-find "phalanx") "The path to the phalanx executable." - :type 'file - :group 'chess-phalanx) + :type 'file) (defvar chess-phalanx-regexp-alist (list @@ -61,7 +60,7 @@ (chess-game-set-data game 'active nil)) (t - (apply 'chess-common-handler game event args))))) + (apply #'chess-common-handler game event args))))) (provide 'chess-phalanx) diff --git a/chess-plain.el b/chess-plain.el index 190d263..500f8a3 100644 --- a/chess-plain.el +++ b/chess-plain.el @@ -1,6 +1,6 @@ -;;; chess-plain.el --- Plain ASCII chess display +;;; chess-plain.el --- Plain ASCII chess display -*- lexical-binding: t; -*- -;; Copyright (C) 2002-2005, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -40,7 +40,6 @@ (defcustom chess-plain-border-style [?+ ?- ?+ ?| ?| ?+ ?- ?+] "If non-nil, a vector describing the border characters." - :group 'chess-plain :type '(choice (const :tag "No border" nil) (vector :tag "Plain ASCII" (const :value ?+ :tag "Upper left corner: +") @@ -72,12 +71,10 @@ (defcustom chess-plain-black-square-char ?. "Character used to indicate empty black squares." - :group 'chess-plain :type 'character) (defcustom chess-plain-white-square-char ?. "Character used to indicate empty white squares." - :group 'chess-plain :type 'character) (defcustom chess-plain-piece-chars '((?K . ?K) @@ -95,7 +92,6 @@ "Alist of pieces and their corresponding characters. Characters defined here should make sense in respect to the current setting of `chess-plain-upcase-indicates'." - :group 'chess-plain :type '(choice (list :tag "White has uppercase english letters and black has lowercase english letters" (const :tag "White King: K" (?K . ?K)) (const :tag "White Queen: Q" (?Q . ?Q)) @@ -195,44 +191,37 @@ lowercase char a black piece. Possible values: 'color (default), 'square-color. If set to 'square-color, a uppercase character indicates a piece on a black square. (Note that you also need to modify `chess-plain-piece-chars' to avoid real confusion.)" - :group 'chess-plain :type '(choice (const :tag "Upcase indicates white piece" color) (const :tag "Upcase indicates black square" square-color))) (defcustom chess-plain-spacing 1 "Number of spaces between files." - :group 'chess-plain :type 'integer) (defface chess-plain-black-face '((((class color) (background light)) (:foreground "Black")) (((class color) (background dark)) (:foreground "Green")) (t (:bold t))) - "The face used for black pieces on the ASCII display." - :group 'chess-plain) + "The face used for black pieces on the ASCII display.") (defface chess-plain-white-face '((((class color) (background light)) (:foreground "Blue")) (((class color) (background dark)) (:foreground "Yellow")) (t (:bold t))) - "The face used for white pieces on the ASCII display." - :group 'chess-plain) + "The face used for white pieces on the ASCII display.") (defface chess-plain-highlight-face '((((class color) (background light)) (:background "#add8e6")) (((class color) (background dark)) (:background "#add8e6"))) - "Face to use for highlighting pieces that have been selected." - :group 'chess-plain) + "Face to use for highlighting pieces that have been selected.") -(defcustom chess-plain-popup-function 'chess-plain-popup +(defcustom chess-plain-popup-function #'chess-plain-popup "The function used to popup a chess-plain display." - :type 'function - :group 'chess-plain) + :type 'function) (defcustom chess-plain-separate-frame nil "If non-nil, display the chessboard in its own frame." - :type 'boolean - :group 'chess-plain) + :type 'boolean) ;;; Code: @@ -314,14 +303,14 @@ PERSPECTIVE is t for white or nil for black." (setq file (if inverted 7 0) rank (if inverted (1- rank) (1+ rank)))) (if chess-plain-border-style - (insert ? (aref chess-plain-border-style 5) + (insert ?\s (aref chess-plain-border-style 5) (make-string (+ 8 (* 7 chess-plain-spacing)) (aref chess-plain-border-style 6)) (aref chess-plain-border-style 7) ?\n - ? ? + ?\s ?\s (let ((string (if (not inverted) "abcdefgh" "hgfedcba"))) - (mapconcat 'string (string-to-list string) - (make-string chess-plain-spacing ? ))))) + (mapconcat #'string (string-to-list string) + (make-string chess-plain-spacing ?\s))))) (set-buffer-modified-p nil) (goto-char pos)))) diff --git a/chess-ply.el b/chess-ply.el index 5490013..f38d8e7 100644 --- a/chess-ply.el +++ b/chess-ply.el @@ -1,6 +1,6 @@ -;;; chess-ply.el --- Routines for manipulating chess plies +;;; chess-ply.el --- Routines for manipulating chess plies -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2008, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -69,6 +69,7 @@ (defsubst chess-ply-p (ply) (and (consp ply) (chess-pos-p (car ply)))) +(cl-deftype chess-ply () '(satisfies chess-ply-p)) (defsubst chess-ply-pos (ply) "Returns the base position associated with PLY." @@ -147,7 +148,7 @@ If KEYWORD is the last element of the changes of ply, `t' is returned." "Return the position that results from executing PLY." (cl-check-type ply chess-ply) (or (chess-ply-keyword ply :next-pos) - (let ((position (apply 'chess-pos-move + (let ((position (apply #'chess-pos-move (chess-pos-copy (chess-ply-pos ply)) (chess-ply-changes ply)))) (chess-pos-set-preceding-ply position ply) @@ -333,7 +334,7 @@ position object passed in." ((memq :any keywords) (let ((chess-ply-throw-if-any t)) (catch 'any-found - (apply 'chess-legal-plies position (delq :any keywords))))) + (apply #'chess-legal-plies position (delq :any keywords))))) ((memq :color keywords) (let ((plies (list t))) (dolist (p (apply #'chess-pos-search* position (if (cadr (memq :color keywords)) diff --git a/chess-polyglot.el b/chess-polyglot.el index 09fc6a0..57ee802 100644 --- a/chess-polyglot.el +++ b/chess-polyglot.el @@ -1,6 +1,6 @@ ;;; chess-polyglot.el --- Polyglot chess book access for Emacs -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014, 2020-2020 Free Software Foundation, Inc. ;; Author: Mario Lang <ml...@delysid.org> ;; Keywords: data, games @@ -56,7 +56,6 @@ A value above 1.0 means to prefer known good moves while a value below 1.0 means to penalize known good moves. 0.0 will force uniform distribution of move weights. For reasons of numerical overflow, this should be strictly less than 4.0." - :group 'chess-polyglot :type '(float :match (lambda (widget value) (and (>= value 0) (< value 4))))) (defvar chess-polyglot-book nil @@ -541,8 +540,7 @@ distribute the probability that a move gets picked." "Path to default polyglot book file. This is used by UCI based engines as well as the internal AI." - :group 'chess-polyglot - :set 'chess-polyglot-book-reload + :set #'chess-polyglot-book-reload :type '(file :must-match t)) (provide 'chess-polyglot) diff --git a/chess-pos.el b/chess-pos.el index 4416766..9c23536 100644 --- a/chess-pos.el +++ b/chess-pos.el @@ -1,4 +1,4 @@ -;;; chess-pos.el --- Routines for manipulating chess positions +;;; chess-pos.el --- Routines for manipulating chess positions -*- lexical-binding: t; -*- ;; Copyright (C) 2002-2020 Free Software Foundation, Inc. diff --git a/chess-puzzle.el b/chess-puzzle.el index 8b4da35..6428bc9 100644 --- a/chess-puzzle.el +++ b/chess-puzzle.el @@ -1,6 +1,6 @@ -;;; chess-puzzle.el --- Support for viewing and solving chess puzzles +;;; chess-puzzle.el --- Support for viewing and solving chess puzzles -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2008, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -41,8 +41,7 @@ (defcustom chess-puzzle-auto-next nil "If non-nil, move to the next puzzle once the position is won." - :type 'boolean - :group 'chess-puzzle) + :type 'boolean) (defvar chess-puzzle-indices nil) (defvar chess-puzzle-position nil) @@ -55,7 +54,7 @@ (end-of-puzzles . "There are no more puzzles in this collection"))) ;;;###autoload -(defun chess-puzzle (file &optional index) ;FIXME: index not used! +(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." @@ -71,7 +70,7 @@ making it easy to go on to the next puzzle once you've solved one." (chess-game-set-data (chess-display-game nil) 'database database) (if chess-puzzle-auto-next (chess-game-add-hook (chess-display-game nil) - 'chess-puzzle-handler display)) + #'chess-puzzle-handler display)) (define-key (current-local-map) [? ] 'chess-puzzle-next) (define-key (current-local-map) [??] 'chess-puzzle-show-solution) (let ((count (chess-database-count database))) diff --git a/chess-random.el b/chess-random.el index a1a7bcf..ab8765c 100644 --- a/chess-random.el +++ b/chess-random.el @@ -1,6 +1,6 @@ -;;; chess-random.el --- Generate Fischer Random style positions +;;; chess-random.el --- Generate Fischer Random style positions -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free diff --git a/chess-scid.el b/chess-scid.el index 58ca27a..6614bed 100644 --- a/chess-scid.el +++ b/chess-scid.el @@ -1,6 +1,6 @@ -;;; chess-scid.el --- A game database that uses SCID for storage/retrieval +;;; chess-scid.el --- A game database that uses SCID for storage/retrieval -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2008 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> diff --git a/chess-sjeng.el b/chess-sjeng.el index 4e2bc41..d27d692 100644 --- a/chess-sjeng.el +++ b/chess-sjeng.el @@ -1,6 +1,6 @@ -;;; chess-sjeng.el --- Play against sjeng! +;;; chess-sjeng.el --- Play against sjeng! -*- lexical-binding: t; -*- -;; Copyright (C) 2004 Free Software Foundation, Inc. +;; Copyright (C) 2004-2020 Free Software Foundation, Inc. ;; Author: Mario Lang <ml...@delysid.org> ;; Keywords: games, processes @@ -20,6 +20,7 @@ ;;; Code: +(require 'chess) ;For `chess-full-name' (require 'chess-common) (require 'chess-fen) (require 'chess-pgn) @@ -31,9 +32,8 @@ :link '(url-link "http://sjeng.sourceforge.net";)) (defcustom chess-sjeng-path (executable-find "sjeng") - "*The path to the sjeng executable." - :type 'file - :group 'chess-sjeng) + "The path to the sjeng executable." + :type 'file) (defvar chess-sjeng-evaluation nil) @@ -115,7 +115,7 @@ (= 1 (mod (car args) 2))) (error "Cannot undo until after sjeng moves")) - (apply 'chess-common-handler game event args))))) + (apply #'chess-common-handler game event args))))) (provide 'chess-sjeng) diff --git a/chess-sound.el b/chess-sound.el index 8397c79..f071afe 100644 --- a/chess-sound.el +++ b/chess-sound.el @@ -1,6 +1,6 @@ -;;; chess-sound.el --- Announce chess moves with pre-recorded sound files +;;; chess-sound.el --- Announce chess moves with pre-recorded sound files -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2008, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -37,31 +37,26 @@ (file-name-directory (or load-file-name buffer-file-name))) "The directory where chess sounds can be found." - :type 'directory - :group 'chess-sound) + :type 'directory) (defcustom chess-sound-play-function (if (fboundp 'play-sound-file) - 'play-sound-file - 'chess-sound-play) + #'play-sound-file + #'chess-sound-play) "Non-nil if chess-sound should play sounds ." - :type 'function - :group 'chess-sound) + :type 'function) (defcustom chess-sound-program (or (executable-find "esdplay") (executable-find "play")) "Program used to play sounds, if `play-sound-file' does not exist." - :type 'file - :group 'chess-sound) + :type 'file) (defcustom chess-sound-args nil "Additional args to pass to `chess-sound-program', before the .WAV file." - :type '(repeat string) - :group 'chess-sound) + :type '(repeat string)) (defcustom chess-sound-my-moves nil "If non-nil, plays the move.wav sound whenever you make a move." - :type 'boolean - :group 'chess-sound) + :type 'boolean) (defsubst chess-sound (file) (ignore-errors @@ -70,7 +65,7 @@ chess-sound-directory)))) (defsubst chess-sound-play (file) - (apply 'call-process chess-sound-program + (apply #'call-process chess-sound-program nil nil nil (append chess-sound-args (list file)))) (defun chess-sound-handler (game event &rest _args) @@ -79,7 +74,7 @@ (and (file-directory-p chess-sound-directory) (file-readable-p (expand-file-name "move.wav" chess-sound-directory)) - (or (eq chess-sound-play-function 'play-sound-file) + (or (eq chess-sound-play-function #'play-sound-file) (and chess-sound-program (file-executable-p chess-sound-program))))) diff --git a/chess-stockfish.el b/chess-stockfish.el index 9a4480a..d1fbb92 100644 --- a/chess-stockfish.el +++ b/chess-stockfish.el @@ -1,6 +1,6 @@ -;;; chess-stockfish.el --- Play against stockfish! +;;; chess-stockfish.el --- Play against stockfish! -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; Author: Mario Lang <ml...@delysid.org> ;; Keywords: games, processes @@ -29,9 +29,8 @@ :link '(url-link "http://www.stockfishchess.com";)) (defcustom chess-stockfish-path (executable-find "stockfish") - "*The path to the stockfish executable." - :type 'file - :group 'chess-stockfish) + "The path to the stockfish executable." + :type 'file) (defvar chess-stockfish-regexp-alist (append @@ -62,7 +61,7 @@ (= 1 (mod (car args) 2))) (error "Cannot undo until after stockfish moves")) - (apply 'chess-uci-handler game event args))))) + (apply #'chess-uci-handler game event args))))) (provide 'chess-stockfish) diff --git a/chess-test.el b/chess-test.el index 5d95195..e8e560b 100644 --- a/chess-test.el +++ b/chess-test.el @@ -1,6 +1,6 @@ -;;; chess-test.el --- Put Emacs Chess through an enormous battery of tests +;;; chess-test.el --- Put Emacs Chess through an enormous battery of tests -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free diff --git a/chess-transport.el b/chess-transport.el index d5a80e7..75c160d 100644 --- a/chess-transport.el +++ b/chess-transport.el @@ -1,6 +1,6 @@ -;;; chess-transport.el --- Example generic transport +;;; chess-transport.el --- Example generic transport -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free @@ -51,7 +51,7 @@ (t ;; Pass all other events down to chess-network - (apply 'chess-network-handler game event args))))) + (apply #'chess-network-handler game event args))))) ;; Call `(chess-engine-submit engine STRING)' for text that arrives ;; from the inbound transport diff --git a/chess-tutorial.el b/chess-tutorial.el index d7d3cc4..b6a2d37 100644 --- a/chess-tutorial.el +++ b/chess-tutorial.el @@ -1,6 +1,6 @@ -;;; chess-tutorial.el --- A simple chess training display +;;; chess-tutorial.el --- A simple chess training display -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2004, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -61,7 +61,7 @@ (with-current-buffer (chess-create-display t) (chess-module-set-leader nil) (chess-display-set-from-fen "8/3p1p/2p3p/4q/2p3p/3p1p/8/N w - -") - (chess-game-add-hook (chess-display-game nil) 'chess-tutorial-knight-1) + (chess-game-add-hook (chess-display-game nil) #'chess-tutorial-knight-1) (setq chess-pos-always-white t) (chess-display-popup nil) (chess-message 'knight-1-done))) diff --git a/chess-ucb.el b/chess-ucb.el index 4ca2bf1..07a394e 100644 --- a/chess-ucb.el +++ b/chess-ucb.el @@ -1,6 +1,6 @@ -;;; chess-ucb.el --- Engine interface to the Novag Universal Chess Board +;;; chess-ucb.el --- Engine interface to the Novag Universal Chess Board -*- lexical-binding: t; -*- -;; Copyright (C) 2002, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2002-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -35,8 +35,7 @@ (defcustom chess-ucb-device "/dev/ttyS0" "The serial device used to talk to the Novag UCB." - :type 'file - :group 'chess-ucb) + :type 'file) (defvar chess-ucb-handling-event nil) @@ -84,7 +83,7 @@ nil)) ((eq event 'undo) - (dotimes (i (car args)) + (dotimes (_ (car args)) (chess-engine-send nil "T\r\n")) ;; prevent us from handling the `undo' event which this triggers (let ((chess-engine-handling-event t)) diff --git a/chess-uci.el b/chess-uci.el index e10e133..58f4095 100644 --- a/chess-uci.el +++ b/chess-uci.el @@ -1,4 +1,4 @@ -;;; chess-uci.el --- Common functions for the Universal Chess Interface protocol +;;; chess-uci.el --- Common functions for the Universal Chess Interface protocol -*- lexical-binding: t; -*- ;; Copyright (C) 2014-2020 Free Software Foundation, Inc. @@ -26,6 +26,7 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) +(require 'chess) ;For `chess-full-name' (require 'chess-common) (require 'chess-polyglot) @@ -135,7 +136,7 @@ If conversion fails, this function fired an 'illegal event." (chess-engine-send nil (concat (chess-uci-position game) "go\n"))))) (t - (apply 'chess-common-handler game event args))))) + (apply #'chess-common-handler game event args))))) (provide 'chess-uci) diff --git a/chess-var.el b/chess-var.el index 58c1c7b..5b7419a 100644 --- a/chess-var.el +++ b/chess-var.el @@ -1,6 +1,6 @@ -;;; chess-var.el --- Manipulate variations +;;; chess-var.el --- Manipulate variations -*- lexical-binding: t; -*- -;; Copyright (C) 2014 Free Software Foundation, Inc. +;; Copyright (C) 2014-2020 Free Software Foundation, Inc. ;; This is free software; you can redistribute it and/or modify it under ;; the terms of the GNU General Public License as published by the Free diff --git a/chess.el b/chess.el index 96d23f9..f21da87 100644 --- a/chess.el +++ b/chess.el @@ -1,6 +1,6 @@ -;;; chess.el --- Play chess in GNU Emacs +;;; chess.el --- Play chess in GNU Emacs -*- lexical-binding: t; -*- -;; Copyright (C) 2001, 2014 Free Software Foundation, Inc. +;; Copyright (C) 2001-2020 Free Software Foundation, Inc. ;; Author: John Wiegley <jo...@gnu.org> ;; Maintainer: Mario Lang <ml...@delysid.org> @@ -97,8 +97,7 @@ "Default display to be used when starting a chess session. A list indicates a series of alternatives if the first display is not available." - :type '(choice symbol (repeat symbol)) - :group 'chess) + :type '(choice symbol (repeat symbol))) (defcustom chess-default-modules '((chess-sound chess-announce) @@ -111,8 +110,7 @@ not available." A sublist indicates a series of alternatives, if the first is not available. These can do just about anything." - :type '(repeat (choice symbol (repeat symbol))) - :group 'chess) + :type '(repeat (choice symbol (repeat symbol)))) (defcustom chess-default-engine '(chess-crafty @@ -122,19 +120,16 @@ These can do just about anything." "Default engine to be used when starting a chess session. A list indicates a series of alternatives if the first engine is not available." - :type '(choice symbol (repeat symbol)) - :group 'chess) + :type '(choice symbol (repeat symbol))) (defcustom chess-full-name (user-full-name) "The full name to use when playing chess." - :type 'string - :group 'chess) + :type 'string) (and (fboundp 'font-lock-add-keywords) (font-lock-add-keywords 'emacs-lisp-mode - '(("(\\(chess-error\\)\\>" 1 font-lock-warning-face) - ("(\\(chess-with-current-buffer\\)\\>" 1 font-lock-keyword-face)))) + '(("(\\(chess-error\\)\\>" 1 font-lock-warning-face)))) (defun chess--create-display (module game my-color disable-popup) (let ((display (chess-display-create game module my-color))) @@ -145,7 +140,7 @@ available." display))) (defun chess--create-engine (module game response-handler ctor-args) - (let ((engine (apply 'chess-engine-create module game + (let ((engine (apply #'chess-engine-create module game response-handler ctor-args))) (when engine ;; for the sake of engines which are ready to play now, and @@ -208,7 +203,7 @@ Otherwise use `chess-default-engine' to determine the engine." 'chess--create-display game my-color disable-popup)) (when (car objects) - (mapc 'chess-display-update objects) + (mapc #'chess-display-update objects) (chess-module-set-leader (car objects)) (unless disable-popup (chess-display-popup (car objects))))