emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 225/255: quit observing IGS game w/o closing connection


From: Eric Schulte
Subject: [elpa] 225/255: quit observing IGS game w/o closing connection
Date: Sun, 16 Mar 2014 01:02:53 +0000

eschulte pushed a commit to branch go
in repository elpa.

commit bdf78fe9e2b585dbf5f95bc190de0c1158ab742c
Author: Eric Schulte <address@hidden>
Date:   Thu Aug 8 11:12:38 2013 -0600

    quit observing IGS game w/o closing connection
---
 back-ends/igs.el |   18 +++++++++++++-----
 go-board.el      |    1 -
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/back-ends/igs.el b/back-ends/igs.el
index 1eaa281..4f08780 100644
--- a/back-ends/igs.el
+++ b/back-ends/igs.el
@@ -332,9 +332,11 @@ This is used to re-send messages to keep the IGS server 
from timing out.")
   (setq *igs-current-game* number)
   (unless (aget (igs-current-game) :board)
     (setf (aget (igs-current-game) :board)
-          (save-excursion (make-instance 'board
-                            :buffer (go-board *igs-instance*
-                                              (make-instance 'sgf)))))
+          (save-excursion
+            (setf (number *igs-instance*) number)
+            (make-instance 'board
+              :buffer (go-board *igs-instance*
+                                (make-instance 'sgf)))))
     (when (aget (igs-current-game) :board)
       (igs-send (format "moves %s" number)))))
 
@@ -388,7 +390,9 @@ This is used to re-send messages to keep the IGS server 
from timing out.")
 
 ;;; Class and interface
 (defclass igs ()
-  ((buffer :initarg :buffer :accessor buffer :initform nil)))
+  ((buffer :initarg :buffer :accessor buffer :initform nil)
+   ;; number of an observed IGS game
+   (number :initarg :number :accessor number :initform nil)))
 
 (defmethod go-connect ((igs igs)) (igs-connect igs))
 
@@ -478,7 +482,11 @@ This is used to re-send messages to keep the IGS server 
from timing out.")
   (signal 'unsupported-back-end-command (list igs :reset)))
 
 (defmethod go-quit ((igs igs))
-  (with-igs igs (igs-send "quit")))
+  (with-igs igs
+    (if (number igs)
+        (progn (igs-send (format "observe %d" (number igs)))
+               (setf (number igs) nil))
+      (igs-send "quit"))))
 
 (defmethod go-score ((igs igs))
   (signal 'unsupported-back-end-command (list igs :score)))
diff --git a/go-board.el b/go-board.el
index a4f8c67..c521aeb 100644
--- a/go-board.el
+++ b/go-board.el
@@ -445,7 +445,6 @@
 (defun go-board-quit ()
   (interactive)
   (when (y-or-n-p "quit: ")
-    (with-backends tr (go-quit tr))
     (kill-buffer (current-buffer))))
 
 (defun go-board-safe-quit ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]