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

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

[elpa] externals/gnugo 7eb0588: [imgen int] Clear cache if secondary cus


From: Thien-Thi Nguyen
Subject: [elpa] externals/gnugo 7eb0588: [imgen int] Clear cache if secondary customization occurred
Date: Mon, 13 Dec 2021 01:53:53 -0500 (EST)

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

    [imgen int] Clear cache if secondary customization occurred
    
    * gnugo-imgen.el (gnugo-imgen-create-xpms):
    Prior to generation, check to see if some gnugo-imgen vars
    have changed since last invocation; if so, clear the cache.
---
 gnugo-imgen.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gnugo-imgen.el b/gnugo-imgen.el
index d7610e2..9b71bf9 100644
--- a/gnugo-imgen.el
+++ b/gnugo-imgen.el
@@ -264,6 +264,14 @@ The returned list is cached; see also 
`gnugo-imgen-clear-cache'."
                     (cdr (assq gnugo-imgen-style gnugo-imgen-styles))
                     (error "No style selected")))
          (key (cons square style)))
+    ;; Do a little cache management first.
+    ;; (Decruft if any "secondary" customization has happened.)
+    (let ((so-far (list gnugo-imgen-char-height-fudge-factor
+                        gnugo-imgen-sizing-function)))
+      (unless (equal so-far (gethash t gnugo-imgen-cache))
+        (gnugo-imgen-clear-cache)
+        (puthash t so-far gnugo-imgen-cache)))
+    ;; Go for it!
     (or (gethash key gnugo-imgen-cache)
         (puthash key (gnugo-imgen-create-xpms-1 square style)
                  gnugo-imgen-cache))))



reply via email to

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