summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chess-pgn.el20
-rw-r--r--chess-pos.el5
-rw-r--r--chess.el3
3 files changed, 15 insertions, 13 deletions
diff --git a/chess-pgn.el b/chess-pgn.el
index 672244b..1cae1b2 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -25,7 +25,7 @@
((looking-at chess-algebraic-regexp)
(goto-char (match-end 0))
(setq prevpos position)
- (let* ((move (match-string 0))
+ (let* ((move (match-string-no-properties 0))
(ply (chess-algebraic-to-ply position move)))
(unless ply
(chess-error 'pgn-read-error move))
@@ -51,8 +51,8 @@
((looking-at "(")
(forward-char)
(skip-chars-forward " \t\n")
- (chess-pos-add-annotation
- prevpos (chess-pgn-read-plies game prevpos)))
+ (chess-pos-add-annotation prevpos
+ (chess-pgn-read-plies game prevpos)))
((and (not top-level)
(looking-at ")"))
@@ -84,14 +84,12 @@
(chess-game-set-tag game (match-string-no-properties 1)
(read (match-string-no-properties 2)))
(goto-char (match-end 0)))
- (let* ((fen (chess-game-tag game "FEN"))
- (position (if fen
- (chess-fen-to-pos fen)
- chess-starting-position)))
- (chess-game-set-plies
- game (or (chess-pgn-read-plies game position t)
- ;; set the starting position to the FEN string
- (list (chess-ply-create* position)))))
+ (let ((fen (chess-game-tag game "FEN")) plies)
+ (if fen
+ (chess-game-set-start-position game (chess-fen-to-pos fen)))
+ (setq plies (chess-pgn-read-plies game (chess-game-pos game) t))
+ (if plies
+ (chess-game-set-plies game plies)))
game)))
(defun chess-pgn-insert-annotations (game index ply)
diff --git a/chess-pos.el b/chess-pos.el
index 5099a17..fc9e162 100644
--- a/chess-pos.el
+++ b/chess-pos.el
@@ -541,10 +541,11 @@ Note: All of the pieces specified by CANDIDATES must be of the same
type."
(let ((cand candidates)
(piece (chess-pos-piece position (car candidates)))
- last-cand king-pos)
+ taken-piece last-cand king-pos)
(while cand
;; determine the resulting position
(chess-pos-set-piece position (car cand) ? )
+ (setq taken-piece (chess-pos-piece position target))
(chess-pos-set-piece position target piece)
;; find the king (only once if the king isn't moving)
(if (or (null king-pos)
@@ -559,7 +560,7 @@ type."
(setq candidates (cdr candidates)))
(setq last-cand cand))
;; return the position to its original state
- (chess-pos-set-piece position target ? )
+ (chess-pos-set-piece position target taken-piece)
(chess-pos-set-piece position (car cand) piece)
;; try the next candidate
(setq cand (cdr cand)))
diff --git a/chess.el b/chess.el
index 4b90b56..d27a3e0 100644
--- a/chess.el
+++ b/chess.el
@@ -202,12 +202,15 @@ available."
objects))
+;;;###autoload
(defalias 'chess-session 'chess)
+;;;###autoload
(defun chess-create-display ()
"Just make a display to use, letting chess.el decide the style."
(cadr (chess-session 'chess-none)))
+;;;###autoload
(defun chess-create-display-object (perspective)
(car (chess-create-modules (list chess-default-display)
'chess--create-display