From d75a340aef4d2e361af2349c0743234623708bf2 Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Sun, 8 Mar 2020 22:09:14 +0000 Subject: [PATCH] Add a copy of the emacs user service --- roles/home-gui/files/emacs.service | 17 +++++++++++++++++ roles/home-gui/tasks/emacs.yml | 11 +---------- 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 roles/home-gui/files/emacs.service 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: