diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-11 01:06:10 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-11 01:06:10 +0000 |
| commit | 3375c5ff17acb3e9af7f2c011a6961e0623d02ad (patch) | |
| tree | a4d175e47627b7d2245893a0ad2334249739853a /chess-display.el | |
| parent | da4dceb58f252519caae28e3b2e049a5bd74c098 (diff) | |
added undo support
Diffstat (limited to 'chess-display.el')
| -rw-r--r-- | chess-display.el | 18 |
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) |
