Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use emacsclient -t when committing in Git

In my .bash_profile, I use this:

export EDITOR=emacsclient
alias e='emacsclient -t'

When I commit changes with Git, it will open a new emacs window, but with emacs --daemon. How can I set my default Git editor to be emacs with the t flag enabled?

like image 593
newlife Avatar asked Apr 27 '12 18:04

newlife


2 Answers

git config --global core.editor 'emacsclient -t -a=\"\"'

This will start a daemon if there is not already one running.

You may be having issues with quotation marks, as it shows up in my .gitconfig as

[core]
    editor = emacsclient -t -a=\\\"\\\"
like image 136
tacaswell Avatar answered Nov 19 '22 00:11

tacaswell


export GIT_EDITOR="`which emacsclient` -t -s $EMACS_SERVER_FILE"

git seems to muck with the PATH variable before calling your EDITOR or GIT_EDITOR so the built in emacsclient from /usr/bin gets called even if normally the emacsclient from your more up to date Emacs would be called. I solved this by getting the path to the executable from a subprocess which has its own environment I believe (either way it works...).

Tested on OS X 10.8.2 with Emacs 24.1 built locally, server running and clients connecting via socket.

I have not tested tcp clients.

like image 5
Camden Narzt Avatar answered Nov 19 '22 01:11

Camden Narzt