]> code.delx.au - gnu-emacs-elpa/commitdiff
[gnugo] Don't display "Abdication {en,dis}abled".
authorThien-Thi Nguyen <ttn@gnu.org>
Fri, 25 Apr 2014 11:18:16 +0000 (13:18 +0200)
committerThien-Thi Nguyen <ttn@gnu.org>
Fri, 25 Apr 2014 11:18:16 +0000 (13:18 +0200)
That tends to persist in the echo area, which is
both annoying and misleading should the game end.

* packages/gnugo/gnugo.el (gnugo--display-suggestion): New func.
(gnugo-get-move-insertion-filter): Use it.
(gnugo-toggle-abdication): Use ‘force-mode-line-update’;
don't ‘message’ state; however, retain "suggestion
forthcoming" message via ‘gnugo--display-suggestion’.

packages/gnugo/gnugo.el

index 67fec6bfe37db85a508bc24855283fa7887582af..b54ce2bb4b38b4cfcf813f1a1b9a397358a04481 100644 (file)
@@ -1638,6 +1638,11 @@ its move."
       (when (string-match old name)
         (rename-buffer (replace-match new t t name))))))
 
+(defun gnugo--display-suggestion (color suggestion)
+  (message "%sSuggestion for %s: %s"
+           (gnugo-get :diamond)
+           color suggestion))
+
 (defun gnugo-get-move-insertion-filter (proc string)
   (with-current-buffer (process-buffer proc)
     (let* ((so-far (gnugo-get :get-move-string))
@@ -1654,9 +1659,7 @@ its move."
                 (unless (or (gnugo--passp full)
                             (eq 'nowarp suggestion))
                   (gnugo-goto-pos full))
-                (message "%sSuggestion for %s: %s"
-                         (gnugo-get :diamond)
-                         color full))
+                (gnugo--display-suggestion color full))
             (let* ((donep (gnugo-push-move color full))
                    (buf (current-buffer)))
               (gnugo--finish-move buf)
@@ -2319,15 +2322,9 @@ transformed into a move suggestion (see `gnugo-request-suggestion')."
       (gnugo-gate t)
       (gnugo-put :abd t)
       (gnugo-get-move (gnugo-other last-mover)))
-    (message "Abdication %sabled%s"
-             (if (gnugo-get :abd)
-                 "en"
-               "dis")
-             (if xform
-                 (format " (suggestion for %s forthcoming)"
-                         (gnugo-get :user-color))
-               ""))
+    (force-mode-line-update)            ; hmm
     (when xform
+      (gnugo--display-suggestion (gnugo-get :user-color) "forthcoming")
       (sleep-for 2))))
 
 ;;;---------------------------------------------------------------------------