Emacs 服务器/emacsclient 无法连接

Emacs 服务器/emacsclient 无法连接

我刚刚在联想 W541 笔记本电脑上安装了 Ubuntu 18.04 和 GNU Emacs 26.1(build 2,x86_64-pc-linux-gnu,GTK+ 版本 3.22.30)。在此新安装下,emacs 服务器和 emacsclient 功能不再起作用。在命令提示符下调用“emacsclient”告诉我

emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".

但是当我尝试在 emacs 中启动服务器时,

‘server-start’ is an obsolete command; use ‘gnuserv-start’ instead.
Server subprocess exited
You can run the command ‘server-start’ with M-x ser-s RET
Server subprocess exited

解决方案是否只是(按照建议)安装 gnuserv ?

更新 1 为了响应@waltinator的建议,我输入^H+f server-start 并得到响应:

server-start is an interactive autoloaded Lisp function in
‘server.el’.
(server-start &optional LEAVE-DEAD)
This function is obsolete;
use ‘gnuserv-start’ instead.
Use ‘gnuserv-start’ instead of this function.
Allow this Emacs process to be a server for client processes.
This starts a server communications subprocess through which
client "editors" can send your editing commands to this Emacs job.
To use the server, set up the program ‘emacsclient’ in the
Emacs distribution as your standard "editor".
--
Prefix arg means just kill any existing server communications subprocess.

但是仍然没有与“gnuserv-start”相匹配的产品,在线上也没有明确说明如何安装它(页面通常会指出它应该与 Emacs 一起安装)。您有什么想法吗?

答案1

事实证明,解决方案是将以下几行放入我的 .emacs 启动文件中:

(autoload 'gnuserv-start "gnuserv-compat"
         "Allow this Emacs process to be a server for client   processes."
         t)
(gnuserv-start)
(setq gnuserv-frame (selected-frame))

然后 'gnuclient filename &' 会在主 emacs 缓冲区中打开 'filename'。奇怪的是 'emacsclient' 不再起作用,但是... 就是这样。

相关内容