I'd like to use emacsclient to edit emails in Mutt.
I added this in .emacs
(server-start)
And in .muttrc I added
set editor="emacsclient -nw %s"
It seems they work.
When I start a second Emacs, it complains there is already a server running so it issues errors. How to make sure to do (server-start)
only if the server isn't already started?
Thanks
The emacs daemon can be started automatically in a very simple manner. Just add this to your .bashrc/.zshrc/whatever
export ALTERNATE_EDITOR=""
Now when you invoke emacsclient
(using either --tty
or --create-frame
) the server will be started (with emacs --daemon
) if it's not already running.
I also find this shell alias handy:
alias e='emacsclient --tty'
Note that since Emacs 23 this is the preferred way to use Emacs in daemon mode. (start-server)
is now mostly deprecated.