emacs-diffs
[Top][All Lists]
Advanced

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

master 316c082d58: Make adding things to the tool bar show up on next re


From: Lars Ingebrigtsen
Subject: master 316c082d58: Make adding things to the tool bar show up on next redisplay
Date: Tue, 3 May 2022 12:19:29 -0400 (EDT)

branch: master
commit 316c082d58601119372a0ae6745cba96f3404c86
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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).
---
 lisp/tool-bar.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index 7ec5c0becc..1271d1de23 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."



reply via email to

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