我希望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"
答案 0 :(得分:2)
您必须在启动服务器之前设置名称:
emacs --eval '(setq server-name "foo")' --eval '(server-start)' --no-splash fileA &