Skip to content

Instantly share code, notes, and snippets.

@gbraad
Last active July 29, 2023 16:31
Show Gist options
  • Save gbraad/6849b3de881c5efd12de4537d89a5c3c to your computer and use it in GitHub Desktop.
Save gbraad/6849b3de881c5efd12de4537d89a5c3c to your computer and use it in GitHub Desktop.
Emacs as a service

Emacs as a service

$ touch /etc/systemd/system/emacs.service
$ chmod 664 /etc/systemd/system/emacs.service

/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=default.target
$ systemctl daemon-reload
$ systemctl start emacs.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment