无法识别Emacsclient服务器名称

时间:2014-08-13 13:24:53

标签: emacs elisp emacsclient

我希望emacsclient从命令行连接到给定的Emacs服务器。阅读手册Using Emacs as a Server我以为我可以这样做:

emacs --eval '(server-start)' --eval "(set-variable 'server-name \"foo\")" --no-splash fileA &

然后再说:

emacsclient -s "foo" -n fileB

但这会产生错误:

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

但是,我可以这样做:

emacsclient -e '(prin1 server-name)'

给出了

"foo"

1 个答案:

答案 0 :(得分:2)

您必须在启动服务器之前设置名称​​:

emacs --eval '(setq server-name "foo")' --eval '(server-start)' --no-splash fileA &