mlang pushed a commit to branch externals/chess in repository elpa. commit 25e9d04f38da45c2fb1b76b8b2cc6ff9fd8c51e4 Author: Mario Lang <ml...@delysid.org> Date: Mon Jul 28 12:03:44 2014 +0200
* chess-database.el (chess-database-do-open): Require modules here. (chess-database-open): Instead of only requiring modules from `chess-database-modules'. * chess-pgn.el (chess-pgn-read-plies): Avoid copying comments (annotations in PGN-jargon) to all following positions in a game. (chess-create-display): Declare. * chess-ics1.el (chess-debug-position): Use `chess-display-position' instead of `chess-engine-position'. * chess-engine.el (chess-pgn): Require it. * chess-eco.el (chess-algebraic): Same here. * chess-input.el (chess-display-highlight-legal) (chess-display-redraw, chess-display-highlight): Declare. --- ChangeLog | 17 +++++++++++++++++ Makefile | 2 ++ NEWS | 12 ++++++++++++ chess-database.el | 26 +++++++++++++------------- chess-eco.el | 3 ++- chess-engine.el | 1 + chess-ics1.el | 2 +- chess-input.el | 4 ++++ chess-pgn.el | 3 +++ 9 files changed, 55 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0fdb9b..245d8b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ 2014-07-28 Mario Lang <ml...@delysid.org> + * chess-database.el (chess-database-do-open): Require modules here. + (chess-database-open): Instead of only requiring modules from + `chess-database-modules'. + + * chess-pgn.el (chess-pgn-read-plies): Avoid copying comments + (annotations in PGN-jargon) to all following positions in a game. + (chess-create-display): Declare. + + * chess-ics1.el (chess-debug-position): Use `chess-display-position' + instead of `chess-engine-position'. + + * chess-engine.el (chess-pgn): Require it. + * chess-eco.el (chess-algebraic): Same here. + + * chess-input.el (chess-display-highlight-legal) + (chess-display-redraw, chess-display-highlight): Declare. + * chess-ply.el (chess-ply-keyword): Add docstring. * chess-input.el (chess-input): New custom group. diff --git a/Makefile b/Makefile index 4c9f462..59c366e 100644 --- a/Makefile +++ b/Makefile @@ -18,9 +18,11 @@ chess-eco.fen: chess-eco.pos dir: chess.info $(INSTALL_INFO) $< $@ +chess-algebraic.elc: chess-ply.elc chess-pos.elc chess-database.elc: chess-message.elc chess-file.elc chess-scid.elc chess-file.elc: chess-fen.elc chess-pgn.elc chess-perft.elc: chess-fen.elc chess-ply.elc chess-pos.elc +chess-pgn.elc: chess-algebraic.elc chess-game.elc chess-test.elc: chess-database.elc chess-game.elc chess-perft.elc .el.elc: diff --git a/NEWS b/NEWS index bc12c23..ac0f31d 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,18 @@ This is the NEWS file for Emacs Chess, a chess client and analysis library written in Emacs Lisp. +* Release 2.0.4: + +This is yet another bugfix release, no new features. + +** Fix a bug in PGN annotation parsing. + +** Fix missing dependencies in the ECO module. + +** Make the third argument of `chess-display-redraw' optional, as expected + by the rest of the code. + + * Release 2.0.3: This is a bugfix release which fixes a recursive dependency between diff --git a/chess-database.el b/chess-database.el index c801947..0e29593 100644 --- a/chess-database.el +++ b/chess-database.el @@ -41,17 +41,18 @@ (defun chess-database-do-open (module file) "Returns the opened database object, or nil." - (let* ((name (symbol-name module)) - (handler (intern-soft (concat name "-handler")))) - (unless handler - (chess-error 'no-such-database name)) - (let ((buffer (funcall handler 'open file))) - (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) - (current-buffer)))))) + (when (require module nil t) + (let* ((name (symbol-name module)) + (handler (intern-soft (concat name "-handler")))) + (unless handler + (chess-error 'no-such-database name)) + (let ((buffer (funcall handler 'open file))) + (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) + (current-buffer))))))) (defun chess-database-open (file &optional module) "Returns the opened database object, or nil." @@ -60,8 +61,7 @@ (let (result) (setq module chess-database-modules) (while module - (if (and (require (car module) nil t) - (setq result (chess-database-do-open (car module) file))) + (if (setq result (chess-database-do-open (car module) file)) (setq module nil) (setq module (cdr module)))) result))) diff --git a/chess-eco.el b/chess-eco.el index d3ffff0..7485650 100644 --- a/chess-eco.el +++ b/chess-eco.el @@ -20,10 +20,11 @@ ;;; Code: +(require 'chess-algebraic) +(require 'chess-fen) (require 'chess-game) (require 'chess-ply) (require 'chess-pos) -(require 'chess-fen) (defgroup chess-eco nil "Chess opening classification module." diff --git a/chess-engine.el b/chess-engine.el index 3672a43..a825a61 100644 --- a/chess-engine.el +++ b/chess-engine.el @@ -21,6 +21,7 @@ (require 'chess-algebraic) (require 'chess-fen) +(require 'chess-pgn) (require 'chess-module) (defgroup chess-engine nil diff --git a/chess-ics1.el b/chess-ics1.el index ec0c3ed..4be5e60 100644 --- a/chess-ics1.el +++ b/chess-ics1.el @@ -146,7 +146,7 @@ PERSPECTIVE is t for white or nil for black." (defun chess-debug-position (&optional position) "This is a debugging function, and not meant from general use." (interactive) - (let ((pos (or position (chess-engine-position nil)))) + (let ((pos (or position (chess-display-position nil)))) (with-current-buffer (get-buffer-create "*scratch*") (chess-ics1-draw pos t) (funcall chess-ics1-popup-function)))) diff --git a/chess-input.el b/chess-input.el index dc7c8d1..4a43c7d 100644 --- a/chess-input.el +++ b/chess-input.el @@ -80,6 +80,10 @@ (t (setq i (1+ i) x (1+ x))))))) ply)) +(defvar chess-display-highlight-legal nil) +(declare-function chess-display-redraw "chess-display" (&optional display)) +(declare-function chess-display-highlight "chess-display" (display &rest args)) + (defun chess-input-display-moves (&optional move-list) (unless move-list (setq move-list diff --git a/chess-pgn.el b/chess-pgn.el index 347f28b..b398abd 100644 --- a/chess-pgn.el +++ b/chess-pgn.el @@ -92,6 +92,7 @@ (unless ply (chess-error 'pgn-read-error move)) (setq position (chess-ply-next-pos ply)) + (chess-pos-set-annotations position nil) (nconc plies (list ply)))) ((and top-level @@ -280,6 +281,8 @@ PGN text." (chess-message-catalog 'english '((could-not-read-pgn . "Could not read or find a PGN game"))) +(declare-function chess-create-display "chess.el" (perspective &optional modules-too)) + ;;;###autoload (defun chess-pgn-read (&optional file) "Read and display a PGN game after point."