1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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.
This commit is contained in:
Lars Ingebrigtsen 2022-05-03 19:20:52 +02:00
parent 99fbf39d61
commit 8ef34a065a

View file

@ -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 ()