[Top][All Lists]

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

[elpa] externals/gnugo b6bb24d 057/357: [gnugo int] Use ‘eq’ less.

From: Stefan Monnier
Subject: [elpa] externals/gnugo b6bb24d 057/357: [gnugo int] Use ‘eq’ less.
Date: Sun, 29 Nov 2020 14:50:47 -0500 (EST)

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

    [gnugo int] Use ‘eq’ less.
    * gnugo.el (gnugo-sentinel): Use ‘memq’.
    (gnugo-move-history finish): New func.
    (gnugo-move-history): Use ‘if’, ‘case’, ‘finish’.
    (:gnugo-gtp-command-spec help): Use ‘if’, ‘case’.
 gnugo.el | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index bafdd81..856db6c 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -311,8 +311,7 @@ Handle the big, slow-to-render, and/or uninteresting ones 
 (defun gnugo-sentinel (proc string)
   (let ((status (process-status proc)))
-    (when (or (eq status 'exit)
-              (eq status 'signal))
+    (when (memq status '(exit signal))
       (let ((buf (process-buffer proc)))
         (when (buffer-live-p buf)
           (with-current-buffer buf
@@ -649,13 +648,16 @@ For all other values of RSEL, do nothing and return nil."
          (tell () (message "(%d moves) %s"
                            (length acc)
-                           (mapconcat 'identity (nreverse acc) " "))))
-      (cond
-       ((not rsel)        (while (next nil)) (tell))
-       ((equal '(4) rsel) (while (next t))   (tell))
-       ((eq 'car rsel)             (car (next nil)))
-       ((eq 'cadr rsel) (next nil) (car (next nil)))
-       ((eq 'count rsel) (aref (gnugo-get :monkey) 2))))))
+                           (mapconcat 'identity (nreverse acc) " ")))
+         (finish (byp) (while (next byp)) (tell)))
+      (if (equal '(4) rsel)
+          (finish t)
+        (case rsel
+          ((nil) (finish nil))
+          (car              (car (next nil)))
+          (cadr  (next nil) (car (next nil)))
+          (count (aref (gnugo-get :monkey) 2))
+          (t nil))))))
 (defun gnugo-boss-is-near ()
   "Do `bury-buffer' until the current one is not a GNU Board."
@@ -1904,12 +1906,11 @@ starting a new one.  See `gnugo-board-mode' 
documentation for more info."
                   (note "handles this command completely"))
                 (when (setq output (plist-get spec :output))
-                  (cond ((functionp output)
-                         (note "handles the output specially"))
-                        ((eq :discard output)
-                         (note "discards the output"))
-                        ((eq :message output)
-                         (note "displays the output in the echo area"))))
+                  (if (functionp output)
+                      (note "handles the output specially")
+                    (case output
+                      (:discard (note "discards the output"))
+                      (:message (note "displays the output in the echo 
                 (when (eq sel cur)
                   (setq found (match-beginning 0))))))
           (cond (found (goto-char found))

reply via email to

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