It is so confusing that emacsclient said it can't find socket just after executing emacs --daemon
in bash:
$ ps aux | grep emacs
shiangro 1744 0.0 0.0 2432784 604 s000 S+ 1:03下午 0:00.00 grep emacs
$ /usr/local/bin/emacs --daemon
("emacs")
Starting Emacs daemon.
Restarting server
$ /usr/local/bin/emacsclient -t
emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".
emacsclient: No socket or alternate editor. Please use:
--socket-name
--server-file (or environment variable EMACS_SERVER_FILE)
--alternate-editor (or environment variable ALTERNATE_EDITOR)
I have this settings in my .emacs:
(server-start)
(setq server-socket-dir "~/.emacs.d/server")
and it works,the server file ~/.emacs.d/server/server
was just there,but emacsclient say it can't find socket,so annoying that I have to tell him the socket file using the -s
option.
I find this thorny problem while I want let emacs runing as a daemon after everytime rebooting(start) systerm by using crontab's ◎reboot
special strings.
In this case ,cron successfully started the emacs server and the server file ~/.emacs.d/server/server
was also there, but later when I started a terminal and tried to emacsclient -t
,it failed and complained can't find socket file!
Although I can bypass this problem by using -s ~/.emacs.d/server/server
everytime I excute emacsclient,or alias emacsclient as emacsclient -s ~/.emacs.d/server/server
,but is ther a better way to comfort my heart?
Backgroud:
system: Mac OS X 10.9.2
emacs: GNU Emacs 24.3.1 installed by homebrew
server-socket-dir
. If you do change it, it's only natural that you'll also need to tell emacsclient.