When you press c c to create a commit from inside a Magit buffer, this is what happens:
The first c constitutes a complete key binding, established in magit-mode-map
. The bound command is magit-commit-popup
, which shows the commit popup in a new buffer.
The second c also is a complete key binding. It is invoked while the popup buffer is already the current buffer, and it is established in magit-popup-mode-map
like so:
(define-key magit-popup-mode-map [remap self-insert-command]
'magit-invoke-popup-action)
I.e. whenever a key would be bound to self-insert-command
without this binding, then bind it to magit-invoke-popup-action
instead. See Remapping Commands for more information.
Because you have mutilated c's binding in global-mode
, that doesn't work anymore. Binding c to that lambda has absolutely no benefit. It does the same thing as using self-insert-command
directly would. And that's even the default binding, so binding to that lambda does not even change the behavior in normal circumstances.
But using a lambda causes the binding to lose its "identity", which results in Magit, and all other packages that do remap self-insert-command
(e.g. isearch
) to something else, to break.
You should never override a self-insert-command
binding in global-map
, certainly not for alphanumeric keys.
Note that defining minor-mode doesn't solve my problem
Depending on what you actually want to do (please explain what it is), this might be your only option. Sorry.