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

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

[elpa] externals/gnugo a0ecdea 257/357: [gnugo] Conditionalize xform war


From: Stefan Monnier
Subject: [elpa] externals/gnugo a0ecdea 257/357: [gnugo] Conditionalize xform warping on abdication disable.
Date: Sun, 29 Nov 2020 14:51:34 -0500 (EST)

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

    [gnugo] Conditionalize xform warping on abdication disable.
    
    * packages/gnugo/gnugo.el (gnugo-toggle-abdication):
    For xform, don't specify ‘nowarp’ unconditionally; instead,
    if user appears to be "following along", specify ‘t’;
    move xform path completely inside disable path.
---
 gnugo.el | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index b54ce2b..81c4361 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -2303,29 +2303,34 @@ a move to play for you, the thinking is not cancelled 
but instead
 transformed into a move suggestion (see `gnugo-request-suggestion')."
   (interactive)
   (let ((last-mover (gnugo-get :last-mover))
-        (abd (gnugo-get :abd))
-        xform)
+        (abd (gnugo-get :abd)))
     (if abd
         ;; disable
         (let* ((gcolor (gnugo-get :gnugo-color))
                (waiting (gnugo-get :waiting))
                (userp (string= last-mover gcolor)))
-          (when (and userp waiting)
-            (gnugo--rename-buffer-portion)
-            (setcdr waiting (setq xform 'nowarp)))
           (when (timerp abd)
             (cancel-timer abd))
           (gnugo--forget :abd)
+          (when (and userp waiting)
+            (let ((u (gnugo-get :user-color)))
+              (gnugo--rename-buffer-portion)
+              (setcdr waiting
+                      ;; heuristic: Warp only if it appears
+                      ;; that the user is "following along".
+                      (or (ignore-errors
+                            (string= (gnugo-position)
+                                     (gnugo-move-history 'bpos u)))
+                          'nowarp))
+              (gnugo--display-suggestion u "forthcoming")
+              (sleep-for 2)))
           (unless (or userp waiting)
             (gnugo-get-move gcolor)))
       ;; enable
       (gnugo-gate t)
       (gnugo-put :abd t)
       (gnugo-get-move (gnugo-other last-mover)))
-    (force-mode-line-update)            ; hmm
-    (when xform
-      (gnugo--display-suggestion (gnugo-get :user-color) "forthcoming")
-      (sleep-for 2))))
+    (force-mode-line-update)))
 
 ;;;---------------------------------------------------------------------------
 ;;; Command properties and gnugo-command



reply via email to

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