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

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

[elpa] 01/01: [gnugo int] Add abstraction: gnugo--passp


From: Thien-Thi Nguyen
Subject: [elpa] 01/01: [gnugo int] Add abstraction: gnugo--passp
Date: Wed, 19 Mar 2014 10:46:57 +0000

ttn pushed a commit to branch master
in repository elpa.

commit 1307ec03dd42a753bc1237bfc5ec1ea38c5a3a64
Author: Thien-Thi Nguyen <address@hidden>
Date:   Wed Mar 19 09:34:57 2014 +0100

    [gnugo int] Add abstraction: gnugo--passp
    
    * packages/gnugo/gnugo.el (gnugo--passp): New defsubst.
    (gnugo-note, gnugo-push-move, gnugo-magic-undo): Use it.
---
 packages/gnugo/gnugo.el |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 4448877..c12c5e7 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -684,11 +684,14 @@ For all other values of RSEL, do nothing and return nil."
   (while (gnugo-board-buffer-p)
     (bury-buffer)))
 
+(defsubst gnugo--passp (string)
+  (string= "PASS" string))
+
 (defun gnugo-note (property value &optional mogrifyp)
   (when mogrifyp
     (let ((sz (gnugo-get :SZ)))
       (cl-labels
-          ((mog (pos) (if (string= "PASS" pos)
+          ((mog (pos) (if (gnugo--passp pos)
                           "tt"
                         (let* ((col (aref pos 0))
                                (one (+ ?a (- col (if (< ?H col) 1 0) ?A)))
@@ -767,9 +770,9 @@ For all other values of RSEL, do nothing and return nil."
          (start (gnugo-get :waiting-start))
          (now (current-time))
          (resignp (string= "resign" move))
-         (passp (string= "PASS" move))
+         (passp (gnugo--passp move))
          (head (gnugo-move-history 'car))
-         (onep (and head (string= "PASS" head)))
+         (onep (and head (gnugo--passp head)))
          (donep (or resignp (and onep passp))))
     (unless passp
       (gnugo-merge-showboard-results))
@@ -1419,7 +1422,7 @@ turn to play.  Optional second arg NOALT non-nil inhibits 
this."
     (let* ((ulastp (string= (gnugo-get :last-mover) user-color))
 
            (ubpos (gnugo-move-history (if ulastp 'car 'cadr))))
-      (gnugo-put :last-user-bpos (if (and ubpos (not (string= "PASS" ubpos)))
+      (gnugo-put :last-user-bpos (if (and ubpos (not (gnugo--passp ubpos)))
                                      ubpos
                                    (gnugo-get :center-position)))
       (gnugo-refresh t)



reply via email to

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