Emacs 后台自动启动-全局层面: Difference between revisions
Jump to navigation
Jump to search
Created page with "<syntaxhighlight lang="bash"> sudo touch /etc/systemd/system/emacs-sudo.service sudo chmod 664 /etc/systemd/system/emacs-sudo.service </syntaxhighlight> <syntaxhighlight lang="bash"> [Unit] Description=Emacs: the extensible, self-documenting text editor [Service] Type=forking ExecStart=/usr/bin/emacs --daemon ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)" Environment=SSH_AUTH_SOCK=%t/keyring/ssh Restart=always [Install] WantedBy=multi-user.target </syntaxhighlight>..." |
No edit summary |
||
| Line 22: | Line 22: | ||
sudo systemctl start emacs.service | sudo systemctl start emacs.service | ||
</syntaxhighlight> | </syntaxhighlight> | ||
以后直接 emacsclient 就可以编辑文件。它有三种选项: | |||
* -n,terminal 不要管 Emacs 编辑结果 | |||
* -c,创建一个新 frame | |||
* -t,terminal 里启动一个 emacs-tui | |||
Latest revision as of 19:55, 19 July 2026
sudo touch /etc/systemd/system/emacs-sudo.service
sudo chmod 664 /etc/systemd/system/emacs-sudo.service
[Unit]
Description=Emacs: the extensible, self-documenting text editor
[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=always
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable emacs.service
sudo systemctl start emacs.service
以后直接 emacsclient 就可以编辑文件。它有三种选项:
- -n,terminal 不要管 Emacs 编辑结果
- -c,创建一个新 frame
- -t,terminal 里启动一个 emacs-tui