summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PLAN8
-rw-r--r--chess-autosave.el11
-rw-r--r--chess-display.el7
-rw-r--r--chess-network.el3
4 files changed, 17 insertions, 12 deletions
diff --git a/PLAN b/PLAN
index b32e76b..2baf874 100644
--- a/PLAN
+++ b/PLAN
@@ -14,14 +14,6 @@ chess
- have an option which causes all completed games to be added to a
given database
-chess-autosave
-- recovering from an autosave against crafty does not seem to work
-
-chess-network
-- how to correctly handle autosaved games, since it's not appropriate
- to ask at initialize time for this module, or chess-irc! And yet,
- we don't want to entirely disable autosaves either.
-
BEFORE FINAL RELEASE
use more asserts throughout the code
diff --git a/chess-autosave.el b/chess-autosave.el
index 03c7574..efb90df 100644
--- a/chess-autosave.el
+++ b/chess-autosave.el
@@ -15,9 +15,10 @@
:group 'chess-autosave)
(chess-message-catalog 'english
- '((chess-read-autosave . "There is a chess autosave file, read it? ")
- (chess-delete-autosave . "Delete the autosave file? ")
- (chess-disable-autosave . "Disable autosaving for this game? ")))
+ '((chess-read-autosave . "There is a chess autosave file, read it? ")
+ (chess-delete-autosave . "Delete the autosave file? ")
+ (chess-disable-autosave . "Disable autosaving for this game? ")
+ (autosave-available . "There is an autosave file; type ~ after connecting to read it")))
(defun chess-autosave-handler (game event &rest args)
(cond
@@ -39,6 +40,10 @@
(if (y-or-n-p (chess-string 'chess-disable-autosave))
(chess-autosave-handler game 'disable-autosave))))))
+ ((eq event 'announce-autosave)
+ (if (file-readable-p chess-autosave-file)
+ (chess-message 'autosave-available)))
+
((eq event 'disable-autosave)
(chess-autosave-handler game 'destroy)
(chess-module-destroy (current-buffer)))
diff --git a/chess-display.el b/chess-display.el
index c90f180..2faf4b3 100644
--- a/chess-display.el
+++ b/chess-display.el
@@ -527,6 +527,7 @@ See `chess-display-type' for the different kinds of displays."
(define-key map [?\{] 'chess-display-annotate)
(define-key map [?\"] 'chess-display-chat)
(define-key map [?\'] 'chess-display-chat)
+ (define-key map [?\~] 'chess-display-check-autosave)
(define-key map [(control ?r)] 'chess-display-search-backward)
(define-key map [(control ?s)] 'chess-display-search-forward)
@@ -830,6 +831,12 @@ Basically, it means we are playing, not editing or reviewing."
(chess-game-run-hooks chess-module-game 'force)
(ding)))
+(defun chess-display-check-autosave ()
+ (interactive)
+ (if (chess-display-active-p)
+ (chess-game-run-hooks chess-module-game 'check-autosave)
+ (ding)))
+
(defun chess-display-resign ()
"Resign the current game."
(interactive)
diff --git a/chess-network.el b/chess-network.el
index 7d22c49..f4a369b 100644
--- a/chess-network.el
+++ b/chess-network.el
@@ -126,7 +126,8 @@
(chess-message 'network-connected))
t))
- ((eq event 'ready)) ; don't set active yet
+ ((eq event 'ready) ; don't set active yet
+ (chess-game-run-hooks game 'announce-autosave))
((eq event 'setup-pos)
(chess-engine-send nil (format "fen %s\n"