Monday, October 4, 2010

Emacs 23, the emacs daemon and emacsclient

A recent entry to planetemacsen reminded me of a wiki entry added a good while
back which complements, or even supercedes, other methods of starting the emacs
daemon. There are a lot of solutions for running the emacs daemon when not
already running and/or using the emacsclient. I find the following solution
most convenient since there is no need to specifically start the server yourself
at any stage - it makes use of the alternate-editor option. Create a small
script and place it somewhere on your path.

# edit
exec emacsclient --alternate-editor="" -c "$@"

The ="" is the key. This tells the emacsclient code to start the daemon and then
call itself if its not already running.

The wiki entry tells you more and describes the use of the EDITOR env variable.

My Emacs Files At GitHub

1 comment:

  1. I just do
    export EDITOR="emacsclient -c -a ''"
    in my ~/.bashrc. For convenience, I also have
    alias E=$EDITOR