branch: externals/gnugo commit 7eb058869d64ec9e3010724e0194ea877d5b946f Author: Thien-Thi Nguyen <t...@gnu.org> Commit: Thien-Thi Nguyen <t...@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))))