From: Lars Ingebrigtsen Date: Tue, 3 May 2022 16:19:13 +0000 (+0200) Subject: Make adding things to the tool bar show up on next redisplay X-Git-Tag: emacs-29.0.90~1931^2~102 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=316c082d58601119372a0ae6745cba96f3404c86;p=emacs.git Make adding things to the tool bar show up on next redisplay * lisp/tool-bar.el (tool-bar--flush-cache): New function. (tool-bar-add-item): Flush the cache (bug#43397). --- diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el index 7ec5c0beccc..1271d1de23b 100644 --- a/lisp/tool-bar.el +++ b/lisp/tool-bar.el @@ -91,6 +91,10 @@ functions.") (defconst tool-bar-keymap-cache (make-hash-table :weakness t :test 'equal)) +(defun tool-bar--flush-cache () + (setf (gethash (cons (frame-terminal) tool-bar-map) 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 @@ -139,7 +143,8 @@ ICON.xbm, using `find-image'. Use this function only to make bindings in the global value of `tool-bar-map'. To define items in any other map, use `tool-bar-local-item'." - (apply #'tool-bar-local-item icon def key tool-bar-map props)) + (apply #'tool-bar-local-item icon def key tool-bar-map props) + (tool-bar--flush-cache)) (defun tool-bar--image-expression (icon) "Return an expression that evaluates to an image spec for ICON."