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

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

[elpa] externals/gnugo 082d56c 178/357: [gnugo int] Use ‘gnugo--decorat


From: Stefan Monnier
Subject: [elpa] externals/gnugo 082d56c 178/357: [gnugo int] Use ‘gnugo--decorate’ more.
Date: Sun, 29 Nov 2020 14:51:16 -0500 (EST)

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

    [gnugo int] Use ‘gnugo--decorate’ more.
    
    * packages/gnugo/gnugo.el (gnugo-board-mode): ...here.
---
 gnugo.el | 40 ++++++++++++++++++++++++----------------
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/gnugo.el b/gnugo.el
index cb122ef..1e0dddf 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -2389,22 +2389,30 @@ In this mode, keys do not self insert.
       (gnugo-put :sgf-collection coll)
       (gnugo-put :monkey (vector (aref (gnugo--tree-ends tree) 0) 0)))
     (gnugo--SZ! board-size)
-    (loop with gb = (gnugo--blackp (gnugo-other user-color))
-          for (property value mogrifyp) in
-          `((:SZ ,board-size)
-            (:DT ,(format-time-string "%Y-%m-%d"))
-            (:RU ,(if (string-match "--chinese-rules" args)
-                      "Chinese"
-                    "Japanese"))
-            (:AP ("gnugo.el" . ,gnugo-version))
-            (:KM ,komi)
-            (,(if gb :PW :PB) ,(user-full-name))
-            (,(if gb :PB :PW) ,(concat "GNU Go " (gnugo-query "version")))
-            ,@(when (not (zerop handicap))
-                `((:HA ,handicap)
-                  (:AB ,(gnugo-lsquery "fixed_handicap %d" handicap)
-                       t))))
-          do (gnugo-note property value mogrifyp)))
+    (let ((root (gnugo--root-node)))
+      (cl-flet
+          ((r! (&rest plist)
+               (gnugo--decorate
+                root (loop              ; hmm, available elsewhere?
+                      while plist
+                      collect (let* ((k (pop plist))
+                                     (v (pop plist)))
+                                (cons k v))))))
+        (r! :SZ board-size
+            :DT (format-time-string "%Y-%m-%d")
+            :RU (if (string-match "--chinese-rules" args)
+                    "Chinese"
+                  "Japanese")
+            :AP (cons "gnugo.el" gnugo-version)
+            :KM komi)
+        (let ((gb (gnugo--blackp (gnugo-other user-color))))
+          (r! (if gb :PW :PB) (user-full-name)
+              (if gb :PB :PW) (concat "GNU Go " (gnugo-query "version"))))
+        (unless (zerop handicap)
+          (r! :HA handicap
+              :AB (mapcar (gnugo--as-cc-func)
+                          (gnugo-lsquery "fixed_handicap %d"
+                                         handicap)))))))
   (gnugo-put :waiting-start (current-time))
   (gnugo-put :hmul 1)
   (gnugo-put :wmul 1)



reply via email to

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