在我的.bash_profile
中,我使用这个:
export EDITOR=emacsclient
alias e='emacsclient -t'
当我使用 Git 提交更改时,它将打开一个新的 emacs 窗口,但带有 emacs --daemon
.如何将我的默认 Git 编辑器设置为启用了 t 标志的 emacs?
git config --global core.editor 'emacsclient -t -a=""'
如果还没有一个守护程序正在运行,这将启动一个守护程序。
您可能遇到引号问题,因为它在我的 .gitconfig 中显示为
[core]
editor = emacsclient -t -a=\"\"
export GIT_EDITOR="`which emacsclient` -t -s $EMACS_SERVER_FILE"
git 似乎在调用你的 EDITOR 或 GIT_EDITOR 之前会用 PATH 变量来混杂,所以来自/usr/bin 的内置 emacsclient 会被调用,即使通常来自更新的 Emacs 的 emacsClient 会被调用。我通过从我相信具有自己的环境的子进程获取可执行文件的路径来解决此问题(无论哪种方式......
在OS X 10.8.2上进行了测试,Emacs 24.1在本地构建,服务器正在运行,客户端通过套接字连接。
我还没有测试过 tcp 客户端。
我通常不会说"阅读那本精美的手册",但在这种情况下,它只是适用。 git commit --help
对这个话题有这样的看法:
ENVIRONMENT AND CONFIGURATION VARIABLES
The editor used to edit the commit log message will be chosen
from the GIT_EDITOR environment variable, the core.editor configuration
variable, the VISUAL environment variable, or the EDITOR environment
variable (in that order). See git-var(1) for details.
真正的原因是Emacs的版本.Mac上有一个默认的emacs,该版本没有"-t"选项。另外,git似乎没有读取.bash_profile中的设置