为什么emacsclient在执行'emacs --daemon'后找不到套接字 [英] Why emacsclient can't find socket after executing 'emacs --daemon'

查看:251
本文介绍了为什么emacsclient在执行'emacs --daemon'后找不到套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

令人困惑的是,emacsclient表示在bash中执行 emacs --daemon 之后找不到套接字:

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)

我的.emacs中有这个设置:

I have this settings in my .emacs:

(server-start)
(setq server-socket-dir "~/.emacs.d/server")

,它的工作原理是,服务器文件〜/ .emacs.d / server / server 刚刚在那里,但emacsclient说它找不到套接字,所以烦恼我必须使用 -s 选项告诉他套接字文件。

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.

我发现这个棘手的问题,而我希望通过使用crontab的◎reboot 特殊字符串重新启动(启动)系统后,让emacs作为守护进程运行。

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.

在这种情况下,cron成功启动了emacs服务器和服务器文件〜/ .emacs.d / server / server 也在那里,但后来当我开始一个终端,并试图 emacsclient -t ,它失败,抱怨找不到套接字文件!

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!

尽管我可以在每次排除emacsclient或别名emacsclient时使用 -s〜/ .emacs.d / server / server 绕过此问题作为 emacsclient -s〜/ .emacs.d / server / server ,但这是一个更好的方式来安慰我的心吗?

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:

系统:Mac OS X 10.9.2

system: Mac OS X 10.9.2

emacs:GNU Emacs 24.3.1由homebrew安装

emacs: GNU Emacs 24.3.1 installed by homebrew

推荐答案

自从你完成了:

/usr/local/bin/emacs --daemon

服务器已经启动。所以,你实际上并不需要这样:

the server is already started. So, you don't actually need the:

(server-start)
(setq server-socket-dir "~/.emacs.d/server")

在.emacs中。当您按照这种方法,服务器被放置在/ tmp / emacs502(或许还有其他数字)。在linux上,emacsclient似乎没有找到它在那里(在这种情况下,我看到/ tmp / emacs1920),所以emacsclient -nw的作品。我正在使用HomeBrew在OSX上尝试使用,我发现我必须使用以下连接:

in your .emacs. When you follow that approach, the server is placed in /tmp/emacs502 (or maybe some other number). On linux, emacsclient doesn't seem to have trouble finding it there (in that case I'm seeing /tmp/emacs1920), and so "emacsclient -nw" works. I'm trying it on OSX using HomeBrew, as you are, and I find I have to connect using:

emacsclient -nw -s /tmp/emacs502/server

(如果你使用了--deamon = name,在最后一行使用名称而不是服务器。)

(If you used --deamon=name, then you would use "name" instead of "server" in that last line.)

这篇关于为什么emacsclient在执行'emacs --daemon'后找不到套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆