[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 02/06: [gnugo int] Add abstraction: gnugo--ERR-wait
From: |
Thien-Thi Nguyen |
Subject: |
[elpa] 02/06: [gnugo int] Add abstraction: gnugo--ERR-wait |
Date: |
Tue, 15 Apr 2014 19:19:47 +0000 |
ttn pushed a commit to branch master
in repository elpa.
commit 687745a4a8af7280522a652e6741f19bcb22a138
Author: Thien-Thi Nguyen <address@hidden>
Date: Tue Apr 15 20:24:18 2014 +0200
[gnugo int] Add abstraction: gnugo--ERR-wait
* packages/gnugo/gnugo.el (gnugo--ERR-wait): New defun.
(gnugo-gate, gnugo-toggle-abdication): Use it.
---
packages/gnugo/gnugo.el | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 0224f9f..76544d1 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/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)
- [elpa] branch master updated (6bafa60 -> 673ecf3), Thien-Thi Nguyen, 2014/04/15
- [elpa] 04/06: [gnugo] Mention ‘gnugo -frolic-mode-hook’., Thien-Thi Nguyen, 2014/04/15
- [elpa] 02/06: [gnugo int] Add abstraction: gnugo--ERR-wait,
Thien-Thi Nguyen <=
- [elpa] 06/06: [gnugo int] Use ‘follo wing-char’ more., Thien-Thi Nguyen, 2014/04/15
- [elpa] 01/06: [gnugo] New command: ‘ C-c C-a’ (gnugo-toggle-abdication), Thien-Thi Nguyen, 2014/04/15
- [elpa] 05/06: [gnugo int] Add abstraction: gnugo--user-play, Thien-Thi Nguyen, 2014/04/15
- [elpa] 03/06: [gnugo int] Add abstraction: gnugo--gate-game-over, Thien-Thi Nguyen, 2014/04/15