Emacs background autostart: Difference between revisions
Jump to navigation
Jump to search
Created page with "<syntaxhighlight lang="bash"> mkdir -p ~/.config/systemd/user nano ~/.config/systemd/user/emacs.service </syntaxhighlight> <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> <syntaxhighlight lang="bash"> systemctl --user daemon-reload systemctl --user enable e..." |
No edit summary |
||
Line 26: | Line 26: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
感谢 | <syntaxhighlight lang="bash" line> | ||
sudo touch /etc/systemd/system/emacs.service | |||
sudo chmod 664 /etc/systemd/system/emacs.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 | |||
</syntaxhighlight> | |||
感谢 DeepSeek,上边全是他教的。从此以后,就可以随时启动 emacsclient 了。 |
Revision as of 10:42, 14 May 2025
mkdir -p ~/.config/systemd/user
nano ~/.config/systemd/user/emacs.service
[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
systemctl --user daemon-reload
systemctl --user enable emacs.service
systemctl --user start emacs.service
systemctl --user status emacs.service
sudo touch /etc/systemd/system/emacs.service
sudo chmod 664 /etc/systemd/system/emacs.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
感谢 DeepSeek,上边全是他教的。从此以后,就可以随时启动 emacsclient 了。