How to do git commits in Emacs buffers

1k views Asked by At

The normal way that I work is to have a small eshell buffer and a larger buffer for the code I'm working on. I use the eshell buffer to do compilation and simple tests.

If I want to do git commits, when I run it this way, I always get a new Emacs window opening up.

How could I get the commit to simply open a new buffer in the current Emacs session?

3

There are 3 answers

1
dotemacs On BEST ANSWER

My guess is that your environment variable $EDITOR is declared as emacs. Since you're not running Emacs as a daemon, it starts a new instance of it. To remedy this you have two options:

  1. configure your $EDITOR to use Emacsclient

  2. use egg or magit, Git frontends for Emacs.
    Egg has a bit of hand holding, since you can see the shortcuts, but Magit is more actively developed.

1
event_jr On

You're bananas if you use Emacs, use git, but don't use magit. Bananas I say!

0
haleyscomet On

I like all my compilation and git/magit messages to appear in the same window in the same frame that triggered the message.

Check out the vars same-window-regexps and same-window-buffer-names as I think that's what you might be looking for.

Here is the setting I use:

(setq same-window-regexps (quote ("\*vc\-.+\*" "\*magit.+\*" "grep" "\*compilation\*\(\|<[0-9]+>\)" "\*Help\*\(\|<[0-9]+>\)" "\*Shell Command Output\*\(\|<[0-9]+>\)" "\*dictem.*")))

Hope that is helpful.

Damon