[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8ef34a065a: Fix thinko in recent tool bar caching logic
From: |
Lars Ingebrigtsen |
Subject: |
master 8ef34a065a: Fix thinko in recent tool bar caching logic |
Date: |
Tue, 3 May 2022 13:21:06 -0400 (EDT) |
branch: master
commit 8ef34a065a10330777b172a7e5608f7939e7af29
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix thinko in recent tool bar caching logic
* lisp/tool-bar.el (tool-bar--cache-key): New function.
(tool-bar--flush-cache, tool-bar-make-keymap): Use it.
---
lisp/tool-bar.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index 490fd0d332..b3915c267c 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -89,17 +89,20 @@ functions.")
(declare-function image-mask-p "image.c" (spec &optional frame))
-(defconst tool-bar-keymap-cache (make-hash-table))
+(defconst tool-bar-keymap-cache (make-hash-table :test #'equal))
+
+(defun tool-bar--cache-key ()
+ (cons (frame-terminal) (sxhash-eq tool-bar-map)))
(defun tool-bar--flush-cache ()
- (setf (gethash (frame-terminal) tool-bar-keymap-cache) nil))
+ (setf (gethash (tool-bar--cache-key) tool-bar-keymap-cache) nil))
(defun tool-bar-make-keymap (&optional _ignore)
"Generate an actual keymap from `tool-bar-map'.
Its main job is to figure out which images to use based on the display's
color capability and based on the available image libraries."
- (or (gethash (frame-terminal) tool-bar-keymap-cache)
- (setf (gethash (frame-terminal) tool-bar-keymap-cache)
+ (or (gethash (tool-bar--cache-key) tool-bar-keymap-cache)
+ (setf (gethash (tool-bar--cache-key) tool-bar-keymap-cache)
(tool-bar-make-keymap-1))))
(defun tool-bar-make-keymap-1 ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 8ef34a065a: Fix thinko in recent tool bar caching logic,
Lars Ingebrigtsen <=