Emacs Magit commit opens new Emacs client
Asked Answered
N

2

13

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

Norling answered 17/9, 2013 at 17:20 Comment(1)
It's export VISUAL=emacsclient in ~/.bashrc on Linux. Maybe there's something similar in OSX.Denumerable
T
16

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.

Td answered 9/10, 2013 at 7:5 Comment(2)
This fixed the issue I was having. I downloaded my copy of Emacs from Homebrew, so my path to emacsclient looks like this: (set-variable 'magit-emacsclient-executable "/usr/local/Cellar/emacs/24.3/bin/emacsclient")Norling
Thank you thank you. At first this was a bit annoying. Then it became a productivity killer. Your hack^H^H^H^H fix has restored sanity on my desktop. Thanks.Rockett
S
1

We have recently made some major changes to magit. The commit mode has greatly changed and has created a lot of quirks. The problems currently investigated, as well as the current known fixes are listed in the Known Issues of the repository. Your issue is one of them.

Succinate answered 17/9, 2013 at 17:35 Comment(3)
Note that if you use the current stable release of magit, you will not have this issue.Basipetal
How make ELPA rollback?Nikolenikoletta
Kanzeon: I guess you remove the package, and reinstall from an earlier version. I don't know the details in this instance. Personally I recommend keeping your entire emacs config under version control, and not relying upon remote package repositories. That way any rollback is always trivial.Basipetal

© 2022 - 2024 — McMap. All rights reserved.