I'm using Git Bash on Windows 7 and have a problem with setting up emacs as the default text editor - I've tried git config --global core.editor emacs
, then git config --global core.editor "'C:/emacs-23.3/bin/runemacs.exe'"
, git config --global core.editor emacsclientw
but to no avail. Each time I enter something like 'emacs README.txt' in Bash, the below error shows:
sh.exe": emacs: command not found
I've put up with this for the longest time, choosing to just open up emacs separately and opening up the related file, but this time I really want to set things up properly so that I can save time and simply invoke emacs from Git Bash. Does anyone know what I can do? Thanks in advance for your help.
You need to ensure the emacs bin directory is on the PATH so that the binary can be found when just entering emacs
or emacsclient
. You can set the default editor for most unix type tool to use your current emacs session by setting the environment variable EDITOR
to emacsclient
. You should use emacsclient rather than emacsclientw because you need the launching tool to wait for the edit to be completed and they do that by waiting for the editor to exit. If you only want git to use this then git config --global core.editor emacsclient
would do the job, or setting GIT_EDITOR=emacsclient in the environment.
In summary:
PATH=c:\emacs-23.3\bin;%PATH%
EDITOR=emacsclient
export PATH EDITOR
or fix the equivalents in the Windows system environment.
You can also try the magit, which is amazing to use Git in emacs. You can get it from https://github.com/magit/magit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With