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

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

[elpa] 01/01: [gnugo int] Use ‘eq’ less.


From: Thien-Thi Nguyen
Subject: [elpa] 01/01: [gnugo int] Use ‘eq’ less.
Date: Thu, 06 Mar 2014 11:46:22 +0000

ttn pushed a commit to branch master
in repository elpa.

commit 12dd14e76f79c16a9dc79bcd467a130e797929f3
Author: Thien-Thi Nguyen <address@hidden>
Date:   Thu Mar 6 12:44:42 2014 +0100

    [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’.
---
 packages/gnugo/gnugo.el |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index bafdd81..856db6c 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -311,8 +311,7 @@ Handle the big, slow-to-render, and/or uninteresting ones 
specially."
 
 (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."
                              acc)))
          (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."
                        :full)
                   (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 
area")))))
                 (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]