簡體   English   中英

在Git中提交時使用emacsclient -t

[英]Use emacsclient -t when committing in Git

在我的.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"

在調用您的EDITOR或GIT_EDITOR之前,git似乎已經使用了PATH變量,因此即使通常會調用來自更新的Emacs的emacsclient,也會調用來自/ usr / bin的內置emacsclient。 我通過從子進程獲取可執行文件的路徑來解決這個問題,我認為它具有自己的環境(無論哪種方式都可以...)。

在OS X 10.8.2上測試,本地構建Emacs 24.1,服務器運行,客戶端通過套接字連接。

我還沒有測試過tcp客戶端。

我通常不會說“Read That Fine Manual”,但在這種情況下它只是適用。 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.tshere的版本是mac上的默認emacs,哪個版本沒有選項“-t”。另外,似乎git不讀取.bash_profile中的設置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM