From 3375c5ff17acb3e9af7f2c011a6961e0623d02ad Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 11 Apr 2002 01:06:10 +0000 Subject: added undo support --- chess-display.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'chess-display.el') 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) -- cgit v1.2.3