![](/img/trans.png)
[英]Emacsclient called by applescript can't find emacs server socket
[英]Centos 7.6 emacsclient can't find socket
我按照說明操作
像這樣在/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 不支持systemctl --user
。
系統信息:
Centos 7.6
Emacs-26.1 manually installed
任何意見,將不勝感激!
我有同樣的問題....
..歸結為我在 emacs 中使用 emacs-snapshot
update-alternatives --display emacs
..和 emacsclient 的不同版本
將它設置為相同的版本,然后好事發生了。
sudo update-alternatives --set emacsclient /usr/bin/emacsclient-snapshot
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.