summaryrefslogtreecommitdiff
path: root/chess-display.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-11 01:06:10 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-11 01:06:10 +0000
commit3375c5ff17acb3e9af7f2c011a6961e0623d02ad (patch)
treea4d175e47627b7d2245893a0ad2334249739853a /chess-display.el
parentda4dceb58f252519caae28e3b2e049a5bd74c098 (diff)
added undo support
Diffstat (limited to 'chess-display.el')
-rw-r--r--chess-display.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/chess-display.el b/chess-display.el
index 67fbf3f..51f9ddc 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -437,6 +437,7 @@ See `chess-display-type' for the different kinds of displays."
(define-key map [?R] 'chess-display-resign)
(define-key map [?A] 'chess-display-abort)
(define-key map [?N] 'chess-display-abort)
+ (define-key map [?U] 'chess-display-undo)
(define-key map [?<] 'chess-display-move-first)
(define-key map [?,] 'chess-display-move-backward)
@@ -668,6 +669,23 @@ Basically, it means we are playing, not editing or reviewing."
(chess-game-run-hooks chess-display-game 'abort)
(ding)))
+(defun chess-display-undo (count)
+ "Abort the current game."
+ (interactive "P")
+ (if (chess-display-active-p)
+ ;; we can't call `chess-game-undo' directly, because not all
+ ;; engines will accept it right away! So we just signal the
+ ;; desire to undo
+ (chess-game-run-hooks
+ chess-display-game 'undo
+ (if count
+ (prefix-numeric-value count)
+ (if (eq (chess-pos-side-to-move
+ (chess-display-position nil))
+ (chess-game-data chess-display-game 'my-color))
+ 2 1)))
+ (ding)))
+
(defun chess-display-list-buffers ()
"List all buffers related to this display's current game."
(interactive)