I understand that in magit the normal way to commit after editing the commit message buffer would be C-c C-c

However in using git from the command line --- with Emacs as the editor for commit messages --- I have gotten used to the keystroke combination for saving the commit message C-x C-s and then killing the buffer C-x k Enter. Is there a way I could continue to do this using magit? In the default magit configuration, the normal keystrokes that I use for killing the buffer are aborting the commit.

  • Please clarify exactly how you "use[d] to the keystroke combination for saving the commit message and then killing the buffer": I can guess C-x C-s for saving but there are various ways to kill a buffer. – Stefan May 26 '18 at 20:18
  • 1
    Your issue seems to be that you find typing C-c C-c an unfamiliar way to take action, but I would firmly recommend that you simply take time to learn that, because C-c C-c is a very common way to take action in Emacs, and crops up in a multitude of libraries. I count more than 80 instances of the binding in core Emacs alone, without even looking at ELPA packages. This is highly unlikely to be the only time you encounter it. – phils May 27 '18 at 0:28

I guess you could unbind C-x C-s and then bind C-x C-s C-x k <RET> to the same command as C-c C-c: with-editor-finish (probably easiest with bind-key).

But I would suggest retraining your muscle-memory, it'll save you keystrokes in the long run.


I will edit with a more detailed answer when I'm on a computer, but a simple fix would be to simply record a macro with the regular C-c C-c C-x k, then simply bind it to your desired set of keystrokes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.