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

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

[elpa] 02/02: [gnugo int] Centralize some constant strings.


From: Thien-Thi Nguyen
Subject: [elpa] 02/02: [gnugo int] Centralize some constant strings.
Date: Tue, 15 Apr 2014 10:32:29 +0000

ttn pushed a commit to branch master
in repository elpa.

commit 6bafa60136baf75b0fba2ea842883f1b38039d03
Author: Thien-Thi Nguyen <address@hidden>
Date:   Tue Apr 15 12:36:38 2014 +0200

    [gnugo int] Centralize some constant strings.
    
    * packages/gnugo/gnugo.el (gnugo--rename-buffer-portion): Rewrite.
    (gnugo-get-move-insertion-filter): Update call.
    (gnugo-request-suggestion): Likewise.
---
 packages/gnugo/gnugo.el |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 1e202ce..97d406d 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -1569,10 +1569,14 @@ its move."
 ;;;---------------------------------------------------------------------------
 ;;; Game play actions
 
-(defun gnugo--rename-buffer-portion (old new)
-  (let ((name (buffer-name)))
-    (when (string-match old name)
-      (rename-buffer (replace-match new t t name)))))
+(defun gnugo--rename-buffer-portion (&optional back)
+  (let ((old "to play")
+        (new "waiting for suggestion"))
+    (when back
+      (rotatef old new))
+    (let ((name (buffer-name)))
+      (when (string-match old name)
+        (rename-buffer (replace-match new t t name))))))
 
 (defun gnugo-get-move-insertion-filter (proc string)
   (with-current-buffer (process-buffer proc)
@@ -1586,8 +1590,7 @@ its move."
           (gnugo-put :waiting nil)
           (if suggestion
               (progn
-                (gnugo--rename-buffer-portion "waiting for suggestion"
-                                              "to play")
+                (gnugo--rename-buffer-portion t)
                 (unless (or (gnugo--passp full)
                             (eq 'nowarp suggestion))
                   (gnugo-goto-pos pos-or-pass))
@@ -1637,7 +1640,7 @@ Emacs displays the suggestion in the echo area and warps 
the
 cursor to the suggested position.  Prefix arg inhibits warp."
   (interactive "P")
   (gnugo-gate t)
-  (gnugo--rename-buffer-portion "to play" "waiting for suggestion")
+  (gnugo--rename-buffer-portion)
   (gnugo-get-move (gnugo-get :user-color)
                   (if nowarp
                       'nowarp



reply via email to

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