[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 03/04: [gnugo int] Add abstraction: gnugo--finish-move
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 03/04: [gnugo int] Add abstraction: gnugo--finish-move |
Date: |
Tue, 15 Apr 2014 08:53:22 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit 8f9b38bbb09db6ca13e189c972e6b3a93e0a68f1
Author: Thien-Thi Nguyen <address@hidden>
Date: Tue Apr 15 09:24:13 2014 +0200
[gnugo int] Add abstraction: gnugo--finish-move
* packages/gnugo/gnugo.el (gnugo--finish-move): New func.
(gnugo-get-move-insertion-filter, gnugo-move, gnugo-pass): Use it.
---
packages/gnugo/gnugo.el | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 4991040..b15e0bb 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -1546,6 +1546,11 @@ its move."
(when (setq last (gnugo-get :last-user-bpos))
(gnugo-goto-pos last))))
+(defun gnugo--finish-move (buf)
+ (run-hooks 'gnugo-post-move-hook)
+ (with-current-buffer buf
+ (gnugo-refresh)))
+
;;;---------------------------------------------------------------------------
;;; Game play actions
@@ -1560,10 +1565,7 @@ its move."
(gnugo-put :waiting nil)
(gnugo-push-move (string= color (gnugo-get :user-color))
pos-or-pass)
- (let ((buf (current-buffer)))
- (run-hooks 'gnugo-post-move-hook)
- (with-current-buffer buf
- (gnugo-refresh))))))))
+ (gnugo--finish-move (current-buffer)))))))
(defun gnugo-get-move (color)
(gnugo-put :waiting color)
@@ -1608,9 +1610,8 @@ To start a game try M-x gnugo."
(let* ((buf (current-buffer))
(pos (gnugo-position)))
(gnugo-push-move t pos) ; value always nil for non-pass move
- (run-hooks 'gnugo-post-move-hook)
+ (gnugo--finish-move buf)
(with-current-buffer buf
- (gnugo-refresh)
(gnugo-get-move (gnugo-get :gnugo-color)))))
(defun gnugo-mouse-move (e)
@@ -1628,9 +1629,7 @@ To start a game try M-x gnugo."
(gnugo-gate t)
(let ((donep (gnugo-push-move t "PASS"))
(buf (current-buffer)))
- (run-hooks 'gnugo-post-move-hook)
- (with-current-buffer buf
- (gnugo-refresh))
+ (gnugo--finish-move buf)
(unless donep
(with-current-buffer buf
(gnugo-get-move (gnugo-get :gnugo-color))))))