[Top][All Lists]

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

[elpa] externals/gnugo 8211cb9 224/357: [gnugo int] Couple :center-posit

From: Stefan Monnier
Subject: [elpa] externals/gnugo 8211cb9 224/357: [gnugo int] Couple :center-position and :SZ jamming.
Date: Sun, 29 Nov 2020 14:51:26 -0500 (EST)

branch: externals/gnugo
commit 8211cb9a513db7c547fc17138d29aff47dfdffdf
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>

    [gnugo int] Couple :center-position and :SZ jamming.
    * packages/gnugo/gnugo.el (gnugo--SZ!):
    Convert to ‘defun’; also compute/assign :center-position.
    (gnugo): Don't compute :center-position explicitly,
    but do move point to it, after the refresh.
 gnugo.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index 006fad5..06cabac 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -1850,8 +1850,12 @@ If FILENAME already exists, Emacs confirms that you wish 
to overwrite it."
 (defsubst gnugo--nodep (x)
   (keywordp (caar x)))
-(defsubst gnugo--SZ! (size)
-  (gnugo-put :SZ size))
+(defun gnugo--SZ! (size)
+  (gnugo-put :SZ size)
+  (gnugo-put :center-position
+    (funcall (gnugo--as-pos-func)
+             (let ((c (+ -1 ?a (truncate (1+ size) 2))))
+               (string c c)))))
 (defun gnugo--plant-and-climb (collection &optional sel)
   (gnugo-put :sgf-collection collection)
@@ -2510,11 +2514,7 @@ starting a new one.  See `gnugo-board-mode' 
documentation for more info."
       (gnugo-put :waiting-start (current-time))
       (gnugo-refresh t)
-      (let ((half (truncate (1+ (gnugo-get :SZ)) 2)))
-        (gnugo-goto-pos (format "A%d" half))
-        (forward-char (* 2 (1- half)))
-        (gnugo-put :center-position
-          (get-text-property (point) 'gnugo-position)))
+      (gnugo-goto-pos (gnugo-get :center-position))
       ;; first move
       (gnugo-put :game-start-time (current-time))
       (let ((g (gnugo-get :gnugo-color))

reply via email to

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