summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chess-display.el3
-rw-r--r--chess-pgn.el3
-rw-r--r--chess-ply.el10
3 files changed, 11 insertions, 5 deletions
diff --git a/chess-display.el b/chess-display.el
index 27fadbb..a7fa21d 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -824,7 +824,8 @@ Basically, it means we are playing, not editing or reviewing."
(if (chess-pos-side-to-move (chess-display-position nil))
"White" "Black")
(1+ (/ (or chess-display-index 0) 2))))))
- (let ((ply (chess-algebraic-to-ply (chess-display-position nil) move)))
+ (let ((ply (let ((chess-ply-allow-interactive-query t))
+ (chess-algebraic-to-ply (chess-display-position nil) move))))
(unless ply
(chess-error 'illegal-notation move))
(chess-display-move nil ply)))
diff --git a/chess-pgn.el b/chess-pgn.el
index c94c039..6417c26 100644
--- a/chess-pgn.el
+++ b/chess-pgn.el
@@ -5,6 +5,7 @@
(require 'chess-algebraic)
(require 'chess-fen)
+(require 'chess-ply)
(require 'chess-message)
(eval-when-compile
@@ -55,7 +56,7 @@
(search-forward "}")
(forward-char)
(chess-pos-add-annotation position (buffer-substring-no-properties
- begin (- (point) 2)))))
+ begin (- (point) 2)))))
((looking-at "(")
(forward-char)
(skip-chars-forward " \t\n")
diff --git a/chess-ply.el b/chess-ply.el
index 826151d..f4c943c 100644
--- a/chess-ply.el
+++ b/chess-ply.el
@@ -163,6 +163,7 @@
'((pawn-promote-query . "Promote to queen? ")))
(defvar chess-ply-checking-mate nil)
+(defvar chess-ply-allow-interactive-query nil)
(defsubst chess-ply-create* (position)
(assert (vectorp position))
@@ -218,9 +219,12 @@ maneuver."
;; jww (2002-05-15): This does not always clear ALL
;; input events
(discard-input) (sit-for 0) (discard-input)
- (let ((new-piece (if (yes-or-no-p
- (chess-string 'pawn-promote-query))
- ?Q ?N)))
+ (let ((new-piece
+ (if chess-ply-allow-interactive-query
+ (if (yes-or-no-p
+ (chess-string 'pawn-promote-query))
+ ?Q ?N)
+ (error "Promotion event without :promote keyword"))))
(nconc changes (list :promote (upcase new-piece)))))
;; is this an en-passant capture?