在Git中提交时使用emacsclient -t

new*_*ife 13 git emacs bash shell

在我.bash_profile,我用这个:

export EDITOR=emacsclient
alias e='emacsclient -t'
Run Code Online (Sandbox Code Playgroud)

当我使用Git提交更改时,它将打开一个新的emacs窗口,但是emacs --daemon.如何将我的默认Git编辑器设置为启用了t标志的emacs?

tac*_*ell 18

git config --global core.editor 'emacsclient -t -a=\"\"'
Run Code Online (Sandbox Code Playgroud)

如果还没有一个守护进程,这将启动一个守护进程.

您可能遇到引号问题,因为它在我的.gitconfig中显示为

[core]
    editor = emacsclient -t -a=\\\"\\\"
Run Code Online (Sandbox Code Playgroud)

  • 只需使用`emacsclient -t -a =`.你不需要报价 (3认同)

Cam*_*rzt 5

export GIT_EDITOR="`which emacsclient` -t -s $EMACS_SERVER_FILE"
Run Code Online (Sandbox Code Playgroud)

在调用您的EDITOR或GIT_EDITOR之前,git似乎已经使用了PATH变量,因此即使通常会调用来自更新的Emacs的emacsclient,也会调用来自/ usr/bin的内置emacsclient.我通过从子进程获取可执行文件的路径来解决这个问题,我认为它具有自己的环境(无论哪种方式都可以...).

在OS X 10.8.2上测试,本地构建Emacs 24.1,服务器运行,客户端通过套接字连接.

我还没有测试过tcp客户端.


new*_*ife 1

真正的原因是emacs的版本。mac上有一个默认的emacs,该版本没有“-t”选项。而且,git似乎没有读取.bash_profile中的设置