sh.exe“:emacs:命令未找到(Git bash Windows)

问题描述:

我在Windows 7上使用Git Bash,并将emacs设置为默认文本编辑器时出现问题 - 我试过git config --global core.editor emacs,然后git config --global core.editor "'C:/emacs-23.3/bin/runemacs.exe'", 。git config --global core.editor emacsclientw但无济于事每次进像在猛砸 'emacs的readme.txt' 文件,下面的错误显示:sh.exe“:emacs:命令未找到(Git bash Windows)

sh.exe“:emacs的:没有发现

我”命令我忍受了最长的时间,选择了单独打开emacs并打开相关文件,但这次我真的想设置一些东西以便我可以节省时间并简单地从Git Bash调用emacs。有谁知道我能做什么?在此先感谢您的帮助。

您需要确保emacs bin目录位于PATH上,以便在刚刚输入emacsemacsclient时可以找到二进制文件。您可以通过将环境变量EDITOR设置为emacsclient来设置大多数unix类型工具的默认编辑器以使用当前的emacs会话。您应该使用emacsclient而不是emacsclientw,因为您需要启动工具来等待编辑完成,并通过等待编辑器退出来执行此操作。如果你只想让git使用它,那么git config --global core.editor emacsclient可以完成这项工作,或者在环境中设置GIT_EDITOR = emacsclient。

总结:

PATH=c:\emacs-23.3\bin;%PATH% 
EDITOR=emacsclient 
export PATH EDITOR 

或固定在Windows系统环境中的等价物。

+0

谢谢你!我在Windows中设置了PATH环境变量,然后做了'git config --global core.editor runemacs'和viola!它的工作就像一个魅力。格拉西亚斯:) – anthonytwp 2012-04-20 01:37:35

你也可以试试magit,这在emacs中使用Git是很了不起的。 你可以从https://github.com/magit/magit