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 commit
works just fine, as a new light-weight instance of emacs is used.Downside: Completion with
M-/
akadabbrev-expand
is 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 commit
on the other hand causes theemacsclient
and serveremacs
processes 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
. – aplaice Nov 14 '17 at 20:59git commit -a
orgit 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-command
with 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 -Q
are smaller than that. – kdb Nov 16 '17 at 11:12emacs -Q
notrunemacs -Q
as I had originally written. Withrunemacs -Q
the editor is detached from git, making git think it was closed with an empty commit message. – kdb Nov 16 '17 at 15:03