diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-25 18:05:45 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-25 18:05:45 -0500 |
| commit | ba7774b79d6e10be2e1d06e329593f64e86ee0f2 (patch) | |
| tree | 266ba900c1ab468c0e1dd92dc72048ff77badabe /modules/help-utils.el | |
| parent | c1c3f31b3fa01754fa8d90c34a70bf80e1102b95 (diff) | |
| download | dotemacs-ba7774b79d6e10be2e1d06e329593f64e86ee0f2.tar.gz dotemacs-ba7774b79d6e10be2e1d06e329593f64e86ee0f2.zip | |
perf(mousetrap): cache built keymaps per profile
mouse-trap--build-keymap ran on every major-mode hook and rebuilt the whole keymap (~8 prefixes by ~30 events) from scratch each time, so rapid mode-switching paid that cost over and over. I moved the build into mouse-trap--build-keymap-1 and cache its result in mouse-trap--keymap-cache, keyed on the profile name plus its allowed-categories list. The same profile reuses the cached keymap, and editing a profile's categories changes the key so it rebuilds.
Sharing one keymap object across buffers is safe here: the map only binds disallowed events to ignore and is never mutated after it's built. Added mouse-trap--clear-keymap-cache to force a fresh build after editing profiles by hand.
Diffstat (limited to 'modules/help-utils.el')
0 files changed, 0 insertions, 0 deletions
