summaryrefslogtreecommitdiffstats
path: root/roles/obs/tasks/emacs.yml
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-11-05 07:55:34 -0400
committerSacha Chua <sacha@sachachua.com>2022-11-05 07:55:34 -0400
commitd33a5923c335332f7401826e01eb2033af717a76 (patch)
tree35a726b46d81a86662bb2e1cf10b1e53c94c9df6 /roles/obs/tasks/emacs.yml
parent0b07963c81155b621dd45b878b869a78b8c9de49 (diff)
downloademacsconf-ansible-d33a5923c335332f7401826e01eb2033af717a76.tar.xz
emacsconf-ansible-d33a5923c335332f7401826e01eb2033af717a76.zip
Publishing and streaming
Diffstat (limited to '')
-rw-r--r--roles/obs/tasks/emacs.yml39
1 files changed, 39 insertions, 0 deletions
diff --git a/roles/obs/tasks/emacs.yml b/roles/obs/tasks/emacs.yml
new file mode 100644
index 0000000..0b013b3
--- /dev/null
+++ b/roles/obs/tasks/emacs.yml
@@ -0,0 +1,39 @@
+- name: Check out emacsconf-el
+ ansible.builtin.git:
+ repo: https://git.emacsconf.org/emacsconf-el
+ dest: "~{{ emacsconf_user }}/emacsconf-el"
+ register: elisp
+ failed_when:
+ - elisp.failed
+ - not 'Local modifications exist in repository' in elisp.msg
+ - not 'Failed to checkout branch' in elisp.msg
+ debugger: on_failed
+- name: Install Emacs packages
+ become_user: "{{ emacsconf_user }}"
+ shell: |
+ emacs --batch --exec "(progn (require 'package)
+ (let ((packages (seq-remove #'package-installed-p '({% for package in packages %}{{ package }} {% endfor %}))))
+ (when packages
+ (package-refresh-contents)
+ (mapc #'package-install packages))))"
+ vars:
+ packages:
+ - modus-themes
+ - vertico
+ - orderless
+- name: Set up Emacs configuration for interactive editing
+ template:
+ src: emacsconf-stream-config.el
+ dest: "{{ emacs_config_dir }}/emacsconf-stream-config.el"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+- name: Add to Emacs configuration
+ lineinfile:
+ dest: "{{ emacs_config_dir }}/init.el"
+ state: present
+ regexp: "emacsconf-stream-config"
+ line: "(load-file \"{{ emacs_config_dir }}/emacsconf-stream-config.el\")"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ create: yes
+