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

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

[elpa] externals/gnugo 425731b 196/357: [gnugo int] Add abstraction: gnu


From: Stefan Monnier
Subject: [elpa] externals/gnugo 425731b 196/357: [gnugo int] Add abstraction: gnugo--ERR-wait
Date: Sun, 29 Nov 2020 14:51:20 -0500 (EST)

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

    [gnugo int] Add abstraction: gnugo--ERR-wait
    
    * packages/gnugo/gnugo.el (gnugo--ERR-wait): New defun.
    (gnugo-gate, gnugo-toggle-abdication): Use it.
---
 gnugo.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index 0224f9f..76544d1 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -329,6 +329,10 @@ Handle the big, slow-to-render, and/or uninteresting ones 
specially."
 (defun gnugo-other (color)
   (if (gnugo--blackp color) "white" "black"))
 
+(defun gnugo--ERR-wait (color why)
+  (user-error "%s -- please wait for \"(%s to play)\""
+              why color))
+
 (defun gnugo-gate (&optional in-progress-p)
   (unless (gnugo-board-buffer-p)
     (user-error "Wrong buffer -- try M-x gnugo"))
@@ -336,11 +340,10 @@ Handle the big, slow-to-render, and/or uninteresting ones 
specially."
     (user-error "No \"gnugo\" process!"))
   (let ((slow (gnugo-get :waiting)))
     (when slow
-      (user-error "%s -- please wait for \"\(%s to play\)\""
-                  (if (cdr slow)
-                      "Still thinking"
-                    "Not your turn yet")
-                  (gnugo-get :user-color))))
+      (gnugo--ERR-wait (gnugo-get :user-color)
+                       (if (cdr slow)
+                           "Still thinking"
+                         "Not your turn yet"))))
   (when (and in-progress-p (gnugo-get :game-over))
     (user-error "Sorry, game over")))
 
@@ -2270,8 +2273,7 @@ This is to ensure that the user is the next to play after 
disabling."
                    (gnugo-get :waiting))
           (assert (not suggestion))
           (when (string= last-mover gcolor)
-            (user-error "Sorry, too soon -- please wait for \"(%s to play\)\""
-                        gcolor))
+            (gnugo--ERR-wait gcolor "Sorry, too soon"))
           (when (timerp abd)
             (cancel-timer abd))
           (gnugo-put :abd nil)



reply via email to

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