diff --git a/roles/home-gui/files/emacs.service b/roles/home-gui/files/emacs.service new file mode 100644 index 0000000..b29177b --- /dev/null +++ b/roles/home-gui/files/emacs.service @@ -0,0 +1,17 @@ +## If your Emacs is installed in a non-standard location, you may need +## to copy this file to a standard directory, eg ~/.config/systemd/user/ . +## If you install this file by hand, change the "Exec" lines below +## to use absolute file names for the executables. +[Unit] +Description=Emacs text editor +Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ + +[Service] +Type=simple +ExecStart=emacs --fg-daemon +ExecStop=emacsclient --eval "(kill-emacs)" +Environment=SSH_AUTH_SOCK=%t/keyring/ssh +Restart=on-failure + +[Install] +WantedBy=default.target diff --git a/roles/home-gui/tasks/emacs.yml b/roles/home-gui/tasks/emacs.yml index 60c2b91..fb127fe 100644 --- a/roles/home-gui/tasks/emacs.yml +++ b/roles/home-gui/tasks/emacs.yml @@ -3,20 +3,11 @@ git: repo: https://code.acperkins.com/acp/emacs.d.git dest: "{{ ansible_env.HOME }}/.emacs.d" -- name: Find Emacs service definition - find: - paths: /usr/share/emacs - patterns: 'emacs.service' - recurse: yes - depth: 3 - register: emacs_service_files - when: ansible_system == 'Linux' - name: Create Emacs user service (Linux) copy: - src: '{{ item.path }}' + src: emacs.service dest: "{{ ansible_env.HOME }}/.config/systemd/user/emacs.service" remote_src: yes - loop: '{{ emacs_service_files.files }}' when: ansible_system == 'Linux' - name: Add Emacs server to autostart (FreeBSD) copy: