How to keep a persistent emacs-server instance running?
I use emacs-server so that I can set emacsclient as the default texteditor and have it open up new files as buffers rather than new emacs instances.
However, this only works when emacs server is running, so how can I have this run at startup and stay in the background?
Another issue is that if i start e开发者_Go百科macs, then quit it and restart it, it tells me:
File error: Cannot bind server socket, address already in use
Assuming you are using Emacs 23, put
emacs --daemon
in your ~/.xsession
(or wherever you place your startup commands).
This page should tell you all you need to know. An alternative to the suggestion igor made is to make a new script somewhere on you path that contains:
#!/bin/bash
export GDK_NATIVE_WINDOWS=1
exec emacsclient --alternate-editor="" -c "$@"
Assuming you are using GTK.
The alternate-editor="" is a shorthand that tells emacs to start a new server if none is found. This is all from the EmacsWiki page. There are also some fixes for the Connection refused error posted. You should always start there when trying to figure out something about emacs.
精彩评论