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

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

[elpa] master a6c204b 2/6: [gnugo int] Lift redundant pall of death comp


From: Thien-Thi Nguyen
Subject: [elpa] master a6c204b 2/6: [gnugo int] Lift redundant pall of death computation.
Date: Tue, 14 Feb 2017 12:28:39 -0500 (EST)

branch: master
commit a6c204b5d1108851408b343b58cfbd7aee406842
Author: Thien-Thi Nguyen <address@hidden>
Commit: Thien-Thi Nguyen <address@hidden>

    [gnugo int] Lift redundant pall of death computation.
    
    * packages/gnugo/gnugo.el (gnugo-refresh) [pall of death]:
    Check :display-using-images exactly once; compute as much
    of the overlay ‘display’ object as possible prior to looping.
---
 packages/gnugo/gnugo.el | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index f1f70ad..e21d35a 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -1033,6 +1033,7 @@ its move."
   (interactive "P")
   (let* ((move (gnugo-move-history 'car))
          (game-over (gnugo-get :game-over))
+         (using-images (gnugo-get :display-using-images))
          (inhibit-read-only t)
          window last)
     (when (and nocache (not (gnugo-get :waiting)))
@@ -1085,20 +1086,27 @@ its move."
          do (setcdr
              head
              (cl-loop
-              with c = (if (gnugo--blackp (car head))
-                           "x"
-                         "o")
+              with color = (car head)
+              with shown = (if using-images
+                               (gnugo-yang (if (gnugo--blackp color)
+                                               ?X
+                                             ?O))
+                             (propertize (if (gnugo--blackp color)
+                                             "x"
+                                           "o")
+                                         'face
+                                         'font-lock-warning-face))
               for p in (mapcar #'gnugo-goto-pos positions)
               collect
               (let ((ov (make-overlay p (1+ p))))
                 (overlay-put
                  ov 'display
-                 (if (gnugo-get :display-using-images)
+                 (if using-images
                      ;; respect the dead individually; it takes more time
                      ;; but that's not a problem (for them)
                      (gnugo-venerate (get-text-property p 'gnugo-yin)
-                                     (gnugo-yang (aref (upcase c) 0)))
-                   (propertize c 'face 'font-lock-warning-face)))
+                                     shown)
+                   shown))
                 ov))))))
     ;; window update
     (when (setq window (get-buffer-window (current-buffer)))



reply via email to

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