evil icon indicating copy to clipboard operation
evil copied to clipboard

evil-local-set-key affects all buffers

Open rybern opened this issue 4 years ago • 0 comments

Issue type

  • Bug report

Environment

Emacs version: 26.3 Operating System: NixOS 19.09 Evil version: evil-git-f79e939bf Graphical/Terminal: Graphical Tested in a make emacs session (see CONTRIBUTING.md): No

Reproduction steps

  • Start Emacs
  • Open file 1 in buffer 1
  • Open file 2 in buffer 2
  • In buffer 1, evaluate expression: (evil-local-set-key 'normal (kbd "SPC f s") 'org-save-all-org-buffers)
  • Return to buffer 2
  • Input "SPC f s"

Expected behavior

Saves buffer 2 as normal

Actual behavior

Executes org-save-all-org-buffers

Further notes

I absolutely might be misunderstanding the point of evil-local-set-key and local maps like evil-normal-state-local-map, but the docs suggest that this map should be local to the buffer, so I expect that I should be able to modify one buffer's map without affecting another.

This came up when I tried to use the add-hook snippet from the first section of the keymap docs: https://evil.readthedocs.io/en/latest/keymaps.html#keymaps

rybern avatar Nov 01 '20 16:11 rybern