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

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

[elpa] 01/02: [gnugo int] Accept color for ‘gnugo-push-move’ 1st arg.


From: Thien-Thi Nguyen
Subject: [elpa] 01/02: [gnugo int] Accept color for ‘gnugo-push-move’ 1st arg.
Date: Tue, 15 Apr 2014 10:32:29 +0000

ttn pushed a commit to branch master
in repository elpa.

commit 414f5260356b549cdb3fb455e425922ba2f2fd6c
Author: Thien-Thi Nguyen <address@hidden>
Date:   Tue Apr 15 12:27:03 2014 +0200

    [gnugo int] Accept color for ‘gnugo-push-move’ 1st arg.
    
    * packages/gnugo/gnugo.el (gnugo-push-move):
    Rename first arg to WHO; if it is not a boolean, take it
    as ‘color’ directly; update "effective userp" ref likewise.
    (gnugo-get-move-insertion-filter):
    Pass ‘color’ directly to ‘gnugo-push-move’.
---
 packages/gnugo/gnugo.el |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 37d5a5b..1e202ce 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -1232,8 +1232,14 @@ This fails if the monkey is on the current branch
               root)
       (delq cur root))))
 
-(defun gnugo-push-move (userp move)
-  (let* ((color (gnugo-get (if userp :user-color :gnugo-color)))
+(defun gnugo-push-move (who move)
+  (let* ((simple (booleanp who))
+         (ucolor (gnugo-get :user-color))
+         (color (if simple
+                    (if who
+                        ucolor
+                      (gnugo-get :gnugo-color))
+                  who))
          (start (gnugo-get :waiting-start))
          (now (current-time))
          (resignp (string= "resign" move))
@@ -1248,7 +1254,9 @@ This fails if the monkey is on the current branch
     (unless passp
       (gnugo-merge-showboard-results))
     (gnugo-put :last-mover color)
-    (when userp
+    (when (if simple
+              who
+            (string= ucolor color))
       (gnugo-put :last-user-bpos (and (not passp) (not resignp) move)))
     ;; update :sgf-gametree and :monkey
     (let* ((property (if (gnugo--blackp color)
@@ -1586,9 +1594,7 @@ its move."
                 (message "%sSuggestion: %s"
                          (gnugo-get :diamond)
                          pos-or-pass))
-            (gnugo-push-move (string= (gnugo-get :user-color)
-                                      color)
-                             pos-or-pass)
+            (gnugo-push-move color pos-or-pass)
             (gnugo--finish-move (current-buffer))))))))
 
 (defun gnugo-get-move (color &optional suggestion)



reply via email to

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