emacs-diffs
[Top][All Lists]
Advanced

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

master d2913901dc: Flush the tool bar cache on all terminals when adding


From: Lars Ingebrigtsen
Subject: master d2913901dc: Flush the tool bar cache on all terminals when adding new entries
Date: Wed, 4 May 2022 03:35:12 -0400 (EDT)

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

    Flush the tool bar cache on all terminals when adding new entries
    
    * lisp/tool-bar.el (tool-bar--flush-cache): Flush the cache for
    the current tool bar on all terminals.
---
 lisp/tool-bar.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index b3915c267c..82b458e010 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -95,7 +95,15 @@ functions.")
   (cons (frame-terminal) (sxhash-eq tool-bar-map)))
 
 (defun tool-bar--flush-cache ()
-  (setf (gethash (tool-bar--cache-key) tool-bar-keymap-cache) nil))
+  "Remove all cached entries that refer to the current `tool-bar-map'."
+  (let ((id (sxhash-eq tool-bar-map))
+        (entries nil))
+    (maphash (lambda (k _)
+               (when (equal (cdr k) id)
+                 (push k entries)))
+             tool-bar-keymap-cache)
+    (dolist (k entries)
+      (remhash k tool-bar-keymap-cache))))
 
 (defun tool-bar-make-keymap (&optional _ignore)
   "Generate an actual keymap from `tool-bar-map'.



reply via email to

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