[elpa] 06/06: Update NEWS.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 00792b5d68aa5c2e8acd3bc816792822fd6bde9a
Author: Mario Lang 
Date:   Mon Jul 28 12:09:39 2014 +0200

Update NEWS.
---
 NEWS |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/NEWS b/NEWS
index ac0f31d..8e980d9 100644
--- a/NEWS
+++ b/NEWS
@@ -10,9 +10,11 @@ This is yet another bugfix release, no new features.
 
 ** Fix missing dependencies in the ECO module.
 
-** Make the third argument of `chess-display-redraw' optional, as expected
+** Make the third argument of `chess-display-draw-square' optional, as expected
by the rest of the code.
 
+** Fix a bug where PGN mode could not load the `chess-file' module.
+
 
 * Release 2.0.3:
 



[elpa] 05/06: * chess-display.el (chess-display-draw-square): Add docstring.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit ad0bd9df140309728b2bbed737380299480cefc3
Author: Mario Lang 
Date:   Mon Jul 28 12:07:54 2014 +0200

* chess-display.el (chess-display-draw-square): Add docstring.
---
 ChangeLog|2 ++
 chess-display.el |7 +++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 245d8b7..308c3e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-07-28  Mario Lang  
 
+   * chess-display.el (chess-display-draw-square): Add docstring.
+
* chess-database.el (chess-database-do-open): Require modules here.
(chess-database-open): Instead of only requiring modules from
`chess-database-modules'.
diff --git a/chess-display.el b/chess-display.el
index a5db238..f7238d2 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -352,6 +352,13 @@ also view the same game."
 (aref chess-display-index-positions index)))
 
 (defun chess-display-draw-square (display index &optional piece pos)
+  "(Re)draw the square of DISPLAY indicated by INDEX.
+Optional argument PIECE indicates the piece (or blank) to draw.
+If it is not provided, `chess-display-position' is consulted.
+Optional argument POS indicates the buffer position to draw the square at.
+If that is not provided, `chess-display-index-pos' is called.
+
+This function is especially useful to clear a previously set highlight."
   (cl-check-type display (or null buffer))
   (cl-check-type index (integer 0 63))
   (cl-check-type piece (member nil ?  ?P ?N ?B ?R ?Q ?K ?p ?n ?b ?r ?q ?k))



[elpa] 04/06: * chess-database.el (chess-database-do-open): Require modules here. (chess-database-open): Instead of only requiring modules from `chess-database-modules'.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 25e9d04f38da45c2fb1b76b8b2cc6ff9fd8c51e4
Author: Mario Lang 
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  
 
+   * 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))
 

[elpa] 03/06: * chess-ply.el (chess-ply-keyword): Add docstring.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 970a24cfcc8bf71a15e5dbc9db6f5538e2fb2920
Author: Mario Lang 
Date:   Mon Jul 28 10:47:03 2014 +0200

* chess-ply.el (chess-ply-keyword): Add docstring.

* chess-input.el (chess-input): New custom group.
(chess-input-notation-type): Put into `chess-input' group.
(chess-input-test-move): Use `chess-ply-keyword' to check for
castling plies instead of doing a string-match on the algebraic
notation string.

* chess-images.el (chess-images-determine-size): Don't use
`x-display-pixel-height' and `x-display-pixel-width' directly.

* chess-display.el (chess-display-draw-square): Make third argument
PIECE optional.
---
 ChangeLog|   16 
 chess-display.el |2 +-
 chess-images.el  |8 ++--
 chess-input.el   |   24 +++-
 chess-ply.el |6 +-
 5 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 935ae2b..c0fdb9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2014-07-28  Mario Lang  
+
+   * chess-ply.el (chess-ply-keyword): Add docstring.
+
+   * chess-input.el (chess-input): New custom group.
+   (chess-input-notation-type): Put into `chess-input' group.
+   (chess-input-test-move): Use `chess-ply-keyword' to check for
+   castling plies instead of doing a string-match on the algebraic
+   notation string.
+
+   * chess-images.el (chess-images-determine-size): Don't use
+   `x-display-pixel-height' and `x-display-pixel-width' directly.
+
+   * chess-display.el (chess-display-draw-square): Make third argument
+   PIECE optional.
+
 2014-06-29  Mario Lang  
 
* chess-algebraic.el (chess-algebraic-to-ply): Remove dead code.
diff --git a/chess-display.el b/chess-display.el
index 857e86d..a5db238 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -351,7 +351,7 @@ also view the same game."
  (point-min))
 (aref chess-display-index-positions index)))
 
-(defun chess-display-draw-square (display index piece &optional pos)
+(defun chess-display-draw-square (display index &optional piece pos)
   (cl-check-type display (or null buffer))
   (cl-check-type index (integer 0 63))
   (cl-check-type piece (member nil ?  ?P ?N ?B ?R ?Q ?K ?p ?n ?b ?r ?q ?k))
diff --git a/chess-images.el b/chess-images.el
index 9b45593..f2e0f03 100644
--- a/chess-images.el
+++ b/chess-images.el
@@ -212,16 +212,12 @@ called."
 (setq cursor-type nil
  chess-images-cache nil
  chess-images-size (chess-images-best-size
-(- (if display
-   (x-display-pixel-height display)
- (display-pixel-height))
+(- (display-pixel-height display)
;; On Macs and Windows, account for
;; the Start/Status bar
(if (memq window-system '(mac windows w32))
80 20))
-(- (if display
-   (x-display-pixel-width display)
- (display-pixel-width)) 20)
+(- (display-pixel-width display) 20)
 
 (defun chess-images-initialize ()
   (let ((map (current-local-map)))
diff --git a/chess-input.el b/chess-input.el
index e34ee50..dc7c8d1 100644
--- a/chess-input.el
+++ b/chess-input.el
@@ -48,8 +48,13 @@
 (make-variable-buffer-local 'chess-input-position-function)
 (make-variable-buffer-local 'chess-input-move-function)
 
+(defgroup chess-input nil
+  "Move input related otpions."
+  :group 'chess)
+
 (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)))
 
@@ -59,19 +64,20 @@
 (i 0) (x 0) (l (length move))
 (xl (length chess-input-move-string)))
 (unless (or (and (equal (downcase chess-input-move-string) "ok")
-(string-match "\\`O-O[+#]?\\'" move))
+(chess-ply-keyword ply :castle))
(and (equal (downcase chess-input-move-string) "oq")
-(string-match "\\`O-O-O[+#]?\\'" move)))
+(chess-ply-keyword ply :long-castle)))
   (while (and (< i l) (< x xl))
(let ((move-char (aref move i))
  (entry-char (aref chess-input-move-string x)))
- (cond
-  ((or (and (= move-char ?x) (/= entry-char ?x))
-   (and (= move-char ?=) (/= entry-char ?=)))
-   (setq i (1+ i)))
-  ((/= entry-char (if (< entry-char ?a) move-char (downcase 
move-char)))
-   (setq ply nil i l))
-  (t (setq i (1+ i) x (1+ x)))
+ (cond ((or (a

[elpa] 02/06: Misc. fixes.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit 8d03eceef113557406163d110f6a2b04b4a1596b
Author: Mario Lang 
Date:   Mon Jul 7 14:33:21 2014 +0200

Misc. fixes.
---
 chess-algebraic.el |   12 +++---
 chess-display.el   |   51 +++-
 chess-input.el |   93 +++
 chess-ply.el   |   27 +++
 chess-polyglot.el  |4 +-
 chess-pos.el   |   32 ++
 chess-uci.el   |   11 +++---
 7 files changed, 121 insertions(+), 109 deletions(-)

diff --git a/chess-algebraic.el b/chess-algebraic.el
index 42b64f1..3a07310 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -140,10 +140,10 @@ This regexp matches short, long and figurine notation.")
 (chess-error 'clarify-piece)
   (while candidates
 (if (if (>= source ?a)
-(eq (chess-index-file (car candidates))
-(- source ?a))
+(= (chess-index-file (car candidates))
+   (chess-file-from-char source))
   (= (chess-index-rank (car candidates))
- (- 7 (- source ?1
+ (chess-rank-from-char source)))
 (setq which (car candidates)
   candidates nil)
   (setq candidates (cdr candidates
@@ -219,8 +219,8 @@ Finally, `:numeric' generates ICCF numeric notation (like 
\"2133\"."
(setq rank (1+ rank)))
  (when (= (chess-index-file candidate) from-file)
(setq file (1+ file
-   (cond ((= file 1) (setq differentiator (+ from-file ?a)))
- ((= rank 1) (setq differentiator (+ (- 7 from-rank) ?1)))
+   (cond ((= file 1) (setq differentiator (chess-file-to-char 
from-file)))
+ ((= rank 1) (setq differentiator (chess-rank-to-char 
from-rank)))
  (t (chess-error 'could-not-diff)))
(chess-ply-set-keyword ply :which differentiator
  (concat
@@ -234,7 +234,7 @@ Finally, `:numeric' generates ICCF numeric notation (like 
\"2133\"."
(differentiator (char-to-string differentiator))
((and (not (eq type :lan)) (= (upcase from-piece) ?P)
  (/= from-file (chess-index-file to)))
-(char-to-string (+ from-file ?a
+(char-to-string (chess-file-to-char from-file
   (if (or (/= ?  (chess-pos-piece pos to))
   (chess-ply-keyword ply :en-passant))
   "x" (if (eq type :lan) "-"))
diff --git a/chess-display.el b/chess-display.el
index fa4358c..857e86d 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -395,35 +395,38 @@ also view the same game."
   "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))
+   (= 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)
   "Move a piece on DISPLAY, by applying the given PLY.
-The position of PLY must match the currently displayed position."
+The position of PLY must match the currently displayed position.
+
+This adds PLY to the game associated with DISPLAY."
   (chess-with-current-buffer display
-(if (and (chess-display-active-p)
-;; `active' means we're playing against an engine
-(chess-game-data chess-module-game 'active)
-(not (eq (chess-game-data chess-module-game 'my-color)
- (chess-game-side-to-move chess-module-game
-   (chess-error 'not-your-move)
-  (if (and (= chess-display-index
- (chess-game-index chess-module-game))
-  (chess-game-over-p chess-module-game))
- (chess-error 'game-is-over)))
-(if (= chess-display-index (chess-game-index chess-module-game))
-   (let ((chess-display-handling-event t))
- (chess-game-move chess-module-game ply)
- (chess-display-paint-move nil ply)
- (chess-display-set-index* nil (chess-game-index chess-module-game))
- (redisplay)   ; FIXME: This is clearly necessary, but 
why?
- (chess-game-run-hooks chess-module-game 'post-move))
-  ;; jww (2002-03-28): This should beget a variation within the
-  ;; game, or alter the game, just as SCID allows
-  (chess-error 'cannot-yet-add
+(cond ((and (chess-display-active-p)
+   ;; `active' means we'r

[elpa] branch externals/chess updated (4ab6c33 -> 00792b5)

2014-07-28 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  4ab6c33   * chess-pos.el (chess-pos-search*) * chess-input.el 
(chess-input-display-moves): cl-delete-duplicates -> delete-dups.
   new  cf74979   * chess-algebraic.el (chess-algebraic-to-ply): Remove 
dead code.
   new  8d03ece   Misc. fixes.
   new  970a24c   * chess-ply.el (chess-ply-keyword): Add docstring.
   new  25e9d04   * chess-database.el (chess-database-do-open): Require 
modules here. (chess-database-open): Instead of only requiring modules from 
`chess-database-modules'.
   new  ad0bd9d   * chess-display.el (chess-display-draw-square): Add 
docstring.
   new  00792b5   Update NEWS.

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog  |   39 +
 Makefile   |2 +
 NEWS   |   14 ++
 chess-algebraic.el |   20 +++-
 chess-database.el  |   26 ++--
 chess-display.el   |   60 +++---
 chess-eco.el   |3 +-
 chess-engine.el|1 +
 chess-ics1.el  |2 +-
 chess-images.el|8 +---
 chess-input.el |  121 ++--
 chess-pgn.el   |3 +
 chess-ply.el   |   33 --
 chess-polyglot.el  |4 +-
 chess-pos.el   |   32 +++---
 chess-uci.el   |   11 +++--
 16 files changed, 232 insertions(+), 147 deletions(-)



[elpa] 01/06: * chess-algebraic.el (chess-algebraic-to-ply): Remove dead code.

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit cf7497969a25b9424ca7aeff230b720c75c75a88
Author: Mario Lang 
Date:   Sun Jun 29 17:16:37 2014 +0200

* chess-algebraic.el (chess-algebraic-to-ply): Remove dead code.
---
 ChangeLog  |4 
 chess-algebraic.el |   14 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e597fa6..935ae2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-29  Mario Lang  
+
+   * chess-algebraic.el (chess-algebraic-to-ply): Remove dead code.
+
 2014-06-25  Mario Lang  
 
* chess-pos.el (chess-pos-search*)
diff --git a/chess-algebraic.el b/chess-algebraic.el
index 808d3e0..42b64f1 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -138,13 +138,12 @@ This regexp matches short, long and figurine notation.")
   (list (car candidates) target)
 (if (null source)
 (chess-error 'clarify-piece)
-  (nconc changes (list :which source))
   (while candidates
 (if (if (>= source ?a)
 (eq (chess-index-file (car candidates))
 (- source ?a))
-  (eq (chess-index-rank (car candidates))
-  (- 7 (- source ?1
+  (= (chess-index-rank (car candidates))
+ (- 7 (- source ?1
 (setq which (car candidates)
   candidates nil)
   (setq candidates (cdr candidates
@@ -220,12 +219,9 @@ Finally, `:numeric' generates ICCF numeric notation (like 
\"2133\"."
(setq rank (1+ rank)))
  (when (= (chess-index-file candidate) from-file)
(setq file (1+ file
-   (cond
-((= file 1)
- (setq differentiator (+ from-file ?a)))
-((= rank 1)
- (setq differentiator (+ (- 7 from-rank) ?1)))
-(t (chess-error 'could-not-diff)))
+   (cond ((= file 1) (setq differentiator (+ from-file ?a)))
+ ((= rank 1) (setq differentiator (+ (- 7 from-rank) ?1)))
+ (t (chess-error 'could-not-diff)))
(chess-ply-set-keyword ply :which differentiator
  (concat
   (unless (= (upcase from-piece) ?P)



[elpa] 01/01: Release 2.0.4

2014-07-28 Thread Mario Lang
mlang pushed a commit to branch externals/chess
in repository elpa.

commit e918d19a919f339171850bc9ccf9797e091ba6d5
Author: Mario Lang 
Date:   Mon Jul 28 17:30:46 2014 +0200

Release 2.0.4
---
 chess.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/chess.el b/chess.el
index 6ed5cd1..96d23f9 100644
--- a/chess.el
+++ b/chess.el
@@ -4,7 +4,7 @@
 
 ;; Author: John Wiegley 
 ;; Maintainer: Mario Lang 
-;; Version: 2.0.3
+;; Version: 2.0.4
 ;; Package-Requires: ((cl-lib "0.5"))
 ;; Keywords: games
 ;; Compatibility: Emacs24
@@ -89,7 +89,7 @@
   :group 'games
   :link '(custom-manual "(chess)Top"))
 
-(defconst chess-version "2.0.3"
+(defconst chess-version "2.0.4"
   "The version of the Emacs chess program.")
 
 (defcustom chess-default-display



[elpa] branch externals/chess updated (00792b5 -> e918d19)

2014-07-28 Thread Mario Lang
mlang pushed a change to branch externals/chess
in repository elpa.

  from  00792b5   Update NEWS.
   new  e918d19   Release 2.0.4

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 chess.el |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)



[elpa] tag chess.el/2.0.4 created (now e918d19)

2014-07-28 Thread Mario Lang
mlang pushed a change to tag chess.el/2.0.4
in repository elpa.

at  e918d19   (commit)
No new revisions were added by this update.