Centos 7.6 emacsclient 找不到套接字



我按照的指示

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files

/etc/systemd/system/下创建一个类似于的emacs.service

Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/
[Service]
Type=forking
ExecStart=/home/hye/bin/emacs --fg-daemon
ExecStop=/home/hye/bin/emacsclient --eval "(kill-emacs)"
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=always
[Install]
WantedBy=default.target

然后我执行:

systemctl daemon-reload
systemctl start emacs.service

emacs.service成功启动

然而,当我在终端中运行emacsclient -t时,它显示:

emacsclient: can't find socket; have you started the server?

我发现,如果我切换到root并在终端中运行emacsclient -t,它会很好地工作。

实际上主机名是/tmp/emacs0/server,但我无法访问它,因为它的所有者是root用户。

emacsclient -t -s /tmp/emacs0/server
emacsclient: can't stat /tmp/emacs0/server: Permission denied
emacsclient: error accessing socket "/tmp/emacs0/server"

我已经尝试在emacs.service中添加用户选项,比如这个

[Service]
User=hye
Group=hye
Type=forking

但是systemctl无法启动此服务,它总是失败。

我还尝试将emacs.service置于~/.config/systemd/user/

但centos 7不支持CCD_ 6。

系统信息:

Centos 7.6
Emacs-26.1 manually installed

任何建议都将不胜感激!

我也遇到了同样的问题。。。。

归根结底,我在中使用emacs快照

update-alternatives --display emacs

以及用于消瘦的不同版本

把它设置为相同的版本,然后好事就发生了。

sudo update-alternatives --set emacsclient /usr/bin/emacsclient-snapshot

最新更新