I am trying to use Emacs 25.1.1 (graphical version, Windows 10) as both the primary editor and the editor for git operations.
In my workflow, I invoke git through M-x shell-command.
I tried the following two options so far:
git config --global core.editor "emacs -Q"With this,
M-x shell-command RET git commitworks just fine, as a new light-weight instance of emacs is used.Downside: Completion with
M-/akadabbrev-expandis less useful than it could be.git config --global core.editor "emacsclient --no-wait --create-frame"With this setting, trying to execute git synchrnously as
M-x shell-command RET git commiton the other hand causes theemacsclientand serveremacsprocesses to hang indefinitely, until `emacsclient is killed, while the asynchrnous invocationM-x shell-command RET git commit &works, but this setup is too brittle, as forgetting the & causes Emacs to all but crash.
Is there some way to use emacsclient as git editor, that is compatible with M-x shell-command?
vc-*commands that are built-in (e.g.C-x v v). As another workaround, you could useM-x async-shell-command.git commit -aorgit commit file1 file2. Due to such issues I prefer working directly with the shell commands over learning multiple interfaces for the same action. The second workaround is equivalent to the use gotshell-commandwith leading&and suffers from the same problems; Most of the time the synchronous version is preferable for me, so its likely I'll end up crashing emacs by forgetting to use the asynchrnous version. The downsides of usingrunemacs -Qare smaller than that.emacs -Qnotrunemacs -Qas I had originally written. Withrunemacs -Qthe editor is detached from git, making git think it was closed with an empty commit message.