jeudi 17 avril 2014

Why emacsclient can't find socket after executing 'emacs --daemon'


Vote count:

0




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
$ emacs --daemon
("emacs")
Starting Emacs daemon.
Restarting server
$ 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.


What is more strange is that when I directly open emacs in bash ,emacsclient can connect to the server which started by (server-start) command,but there is not existing a ~/.emacs.d/server/server file.


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?



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire