|
Replace inline keymap construction with shared wttrin--mode-line-map defvar.
Before (line 474-479): Keymap recreated on every mode-line update
- (let ((map (make-sparse-keymap))) ...)
- Allocates new keymap object each time
- 6 lines of repetitive code
After (line 183-190 + line 483): Shared keymap created once
- (defvar wttrin--mode-line-map ...)
- Reference: 'local-map wttrin--mode-line-map
- Single allocation, no repeated construction
Added comprehensive tests (8 tests, all passing):
- Keymap existence and structure verification
- Keybinding tests (mouse-1, mouse-3, no mouse-2)
- Integration test verifying mode-line uses shared map
Benefits:
- More efficient (no allocation on every update)
- Clearer code structure
- Easier to add new keybindings
- Self-documenting with inline documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|