Emacs 后台自动启动

Revision as of 22:57, 8 November 2024 by Mwroot (talk | contribs) (Created page with "<syntaxhighlight lang="bash" line> mkdir -p ~/.config/systemd/user nano ~/.config/systemd/user/emacs.service <pre> [Unit] Description=Emacs text editor as a daemon Documentation=info:emacs man:emacs(1) [Service] Type=forking ExecStart=/usr/bin/emacs --daemon ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)" Restart=on-failure [Install] WantedBy=default.target </pre> systemctl --user daemon-reload systemctl --user enable emacs.service systemctl --user start emacs.se...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
mkdir -p ~/.config/systemd/user
nano ~/.config/systemd/user/emacs.service

<pre>
[Unit]
Description=Emacs text editor as a daemon
Documentation=info:emacs man:emacs(1)

[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
Restart=on-failure

[Install]
WantedBy=default.target
</pre>

systemctl --user daemon-reload
systemctl --user enable emacs.service
systemctl --user start emacs.service
systemctl --user status emacs.service

感谢 ChatGPT,上边全是他教的。