diff options
| author | Lars Ingebrigtsen | 2022-05-04 09:34:56 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-05-04 09:35:05 +0200 |
| commit | d2913901dcfaec60ce6a199a1252003e818a914d (patch) | |
| tree | 3e49df6db8f38ae4088e7b7fb5fb02f07c0eeff3 | |
| parent | 4c9a7010bc553abb07ccc3c998faff9cf4472ed1 (diff) | |
| download | emacs-d2913901dcfaec60ce6a199a1252003e818a914d.tar.gz emacs-d2913901dcfaec60ce6a199a1252003e818a914d.zip | |
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.
| -rw-r--r-- | lisp/tool-bar.el | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el index b3915c267cc..82b458e0107 100644 --- a/lisp/tool-bar.el +++ b/lisp/tool-bar.el | |||
| @@ -95,7 +95,15 @@ functions.") | |||
| 95 | (cons (frame-terminal) (sxhash-eq tool-bar-map))) | 95 | (cons (frame-terminal) (sxhash-eq tool-bar-map))) |
| 96 | 96 | ||
| 97 | (defun tool-bar--flush-cache () | 97 | (defun tool-bar--flush-cache () |
| 98 | (setf (gethash (tool-bar--cache-key) tool-bar-keymap-cache) nil)) | 98 | "Remove all cached entries that refer to the current `tool-bar-map'." |
| 99 | (let ((id (sxhash-eq tool-bar-map)) | ||
| 100 | (entries nil)) | ||
| 101 | (maphash (lambda (k _) | ||
| 102 | (when (equal (cdr k) id) | ||
| 103 | (push k entries))) | ||
| 104 | tool-bar-keymap-cache) | ||
| 105 | (dolist (k entries) | ||
| 106 | (remhash k tool-bar-keymap-cache)))) | ||
| 99 | 107 | ||
| 100 | (defun tool-bar-make-keymap (&optional _ignore) | 108 | (defun tool-bar-make-keymap (&optional _ignore) |
| 101 | "Generate an actual keymap from `tool-bar-map'. | 109 | "Generate an actual keymap from `tool-bar-map'. |