summaryrefslogtreecommitdiff
path: root/chess-display.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2002-04-10 23:55:13 +0000
committerJohn Wiegley <johnw@newartisans.com>2002-04-10 23:55:13 +0000
commita0769011c2a98841156559aa37978156766cc09f (patch)
tree407832c3c0fac049e9e7d567614894cc47e76f3c /chess-display.el
parent5fbbfaf36f1dc7da3c7539568fe473bbf079c513 (diff)
Added support for aborting a game. Use A or N from a display.
Diffstat (limited to 'chess-display.el')
-rw-r--r--chess-display.el17
1 files changed, 14 insertions, 3 deletions
diff --git a/chess-display.el b/chess-display.el
index d725e6d..67fbf3f 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -393,9 +393,11 @@ See `chess-display-type' for the different kinds of displays."
((eq event 'orient)
;; Set the display's perspective to whichever color I'm playing
- (if chess-display-game
- (chess-display-set-perspective*
- nil (chess-game-data chess-display-game 'my-color))))
+ (when chess-display-game
+ (chess-display-set-index*
+ nil (chess-game-index (chess-display-game nil)))
+ (chess-display-set-perspective*
+ nil (chess-game-data chess-display-game 'my-color))))
((memq event '(move game-over resign))
(chess-display-set-index*
@@ -433,6 +435,8 @@ See `chess-display-type' for the different kinds of displays."
(define-key map [? ] 'chess-display-pass)
(define-key map [?S] 'chess-display-shuffle)
(define-key map [?R] 'chess-display-resign)
+ (define-key map [?A] 'chess-display-abort)
+ (define-key map [?N] 'chess-display-abort)
(define-key map [?<] 'chess-display-move-first)
(define-key map [?,] 'chess-display-move-backward)
@@ -657,6 +661,13 @@ Basically, it means we are playing, not editing or reviewing."
(chess-game-resign chess-display-game)
(ding)))
+(defun chess-display-abort ()
+ "Abort the current game."
+ (interactive)
+ (if (chess-display-active-p)
+ (chess-game-run-hooks chess-display-game 'abort)
+ (ding)))
+
(defun chess-display-list-buffers ()
"List all buffers related to this display's current game."
(interactive)