I'm a happy Magit user, and at commit time, I am accustomed to editing a commit message and then finishing the edit with
C-c C-c. But sometimes that key sequence winds up bound to the
compile function, as indeed my emacs init file contains the line
(global-set-key "\C-c\C-c" 'compile)
My init file also sets that key locally in a number of modes including
lua-mode, and so on. However, none of those modes is displayed on the mode line in the commit-edit window. And when emacs is working correctly,
C-c C-c finishes the edit and returns to git as expected. However, every so often it gets wacky and insists on being bound to
Following a trail of emacs lisp leads a very short distance to where Magit invokes git with
$EMACSCLIENT set appropriately. Beyond that point I have been unable to diagnose how that buffer is created or where its keybindings are determined.
The problem I'm trying to solve is to set the keybindings in the commit-message edit buffer so that
C-c C-c terminates the edit and returns control to git. At the moment, the only way I can do this is to exit emacs and start over. That workaround doesn't last long, and it grows tiresome.
I would welcome answers to any or all of the following questions:
Where are the keybindings set for that window?
What function is
C-c C-cbound to by default?
Is there a mode or other hook where I can just reach in with a hammer and bind
C-c C-cto the right function?
Addendum: the buffer's major mode is
text-mode. Here is the response to
C-h v major-mode RET:
Its value is text-mode
Original value was fundamental-mode
Local in buffer COMMIT_EDITMSG; global value is fundamental-mode