[Top][All Lists]

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

[elpa] externals/gnugo c2f7717 053/357: [gnugo slog] Fix bug: Avoid ‘cl

From: Stefan Monnier
Subject: [elpa] externals/gnugo c2f7717 053/357: [gnugo slog] Fix bug: Avoid ‘cl-lib’ funcs; use only macros.
Date: Sun, 29 Nov 2020 14:50:46 -0500 (EST)

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

    [gnugo slog] Fix bug: Avoid ‘cl-lib’ funcs; use only macros.
    This silences byte-compiler warnings under Emacs 24.4.
    Regression introduced 2014-01-30, "Use ‘cl-labels’ instead of ‘flet’".
    Reported by Juanma Barranquero:
    * gnugo.el: Don't require ‘cl-lib’;
    instead, require ‘cl’, and wrap with ‘eval-when-compile’.
    (gnugo-animate-group): Use ‘loop’, ‘zerop’, ‘logand’.
    (gnugo-describe-position): Use ‘loop’.
 gnugo.el | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index ae4a6a0..65444cd 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -74,7 +74,7 @@
 ;;; Code:
-(require 'cl-lib)                       ; use the source luke!
+(eval-when-compile (require 'cl))       ; use the source luke!
 (require 'time-date)                    ; for `time-subtract'
@@ -1110,17 +1110,15 @@ To start a game try M-x gnugo."
           stones (gnugo-lsquery "%s_stones %s" w/d pos))
     (message "%s %s in group." blurb (length stones))
     (setplist (gnugo-f 'anim) nil)
-    (let* ((spec (let ((spec (split-string gnugo-animation-string "" t)))
-                   (cond ((gnugo-get :display-using-images)
-                          (let* ((yin (get-text-property (point) 'gnugo-yin))
-                                 (yang (gnugo-yang (char-after)))
-                                 (up (get (gnugo-yy yin yang t) 'display))
-                                 (dn (get (gnugo-yy yin yang) 'display)))
-                            (mapcar (lambda (n)
-                                      (if (cl-oddp n)
-                                          dn up))
-                                    (number-sequence 1 (length spec)))))
-                         (t spec))))
+    (let* ((spec (if (gnugo-get :display-using-images)
+                     (loop with yin  = (get-text-property (point) 'gnugo-yin)
+                           with yang = (gnugo-yang (char-after))
+                           with up   = (get (gnugo-yy yin yang t) 'display)
+                           with dn   = (get (gnugo-yy yin yang) 'display)
+                           for n below (length gnugo-animation-string)
+                           collect (if (zerop (logand 1 n))
+                                       dn up))
+                   (split-string gnugo-animation-string "" t)))
            (cell (list spec))
            (ovs (save-excursion
                   (mapcar (lambda (pos)
@@ -1578,11 +1576,12 @@ which placed the stone at point."
 (defun gnugo-switch-to-another ()
   "Switch to another GNU Go game buffer (if any)."
-  (let ((cur (current-buffer)))
-    (switch-to-buffer (cl-find-if 'gnugo-board-buffer-p
-                                  (reverse (buffer-list))))
-    (when (eq cur (current-buffer))
-      (message "(only one)"))))
+  (loop for buf in (cdr (buffer-list))
+        if (gnugo-board-buffer-p buf)
+        return (progn
+                 (bury-buffer)
+                 (switch-to-buffer buf))
+        finally do (message "(only one)")))
 ;;; Command properties and gnugo-command

reply via email to

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