Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs Magit commit opens new Emacs client

I've been using Magit for awhile, and when committing, it used to simply split the window and allow me to commit from within the same emacs session, but I seem to have changed this behavior to the following:

Now, when I commit my staged changes, a new emacs client starts up, taking awhile to load, finally letting me write my commit message. I then run C-c C-c to commit. The commit goes through when I close this client.

How do I force magit to run the commit within the same session of emacs and NOT open a whole new client?

enter image description here

like image 270
FellyTone84 Avatar asked Sep 17 '13 17:09

FellyTone84


1 Answers

This bug is noted (but not solved) as a github issue here: https://github.com/magit/magit/issues/862

I think the issue here is that magit is calling 'emacsclient', which by default is /usr/bin/emacsclient. It needs to call the emacsclient that is packaged with emacs in order to work properly - other emacsclients (from homebrew, macports, etc) won't know how to connect. Normally most of us take care of this with an alias or environment variable in our shell startup scripts. However, when you run emacs.app outside of a shell it won't see these. I was able to get git-commit-mode to work properly by adding this to my init.el:

(set-variable 'magit-emacsclient-executable "/Applications/Emacs.app/Contents/MacOS/bin/emacsclient")

I'm using an EmacsForMacOSX build, 24.3. This worked for me, hopefully it fixes it for you as well.

like image 74
Anton I. Sipos Avatar answered Sep 27 '22 20:09

Anton I. Sipos