summaryrefslogtreecommitdiffstats
path: root/roles/edit
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-11-02 13:08:03 -0400
committerSacha Chua <sacha@sachachua.com>2022-11-02 13:08:03 -0400
commitc569e02d8ab5ebcbb5a44e10c14799fa097c9bc7 (patch)
tree05528005f12160fd505696cb5d89f22d30249f32 /roles/edit
parent4696aa1fed214fe1084d7c3deecaaa289bc0a1fd (diff)
downloademacsconf-ansible-c569e02d8ab5ebcbb5a44e10c14799fa097c9bc7.tar.xz
emacsconf-ansible-c569e02d8ab5ebcbb5a44e10c14799fa097c9bc7.zip
OBS overlays, starting to get publish and edit on res
Diffstat (limited to 'roles/edit')
-rw-r--r--roles/edit/defaults/main.yml3
-rw-r--r--roles/edit/tasks/main.yaml11
-rw-r--r--roles/edit/tasks/main.yml32
-rw-r--r--roles/edit/templates/emacsconf-edit.el52
4 files changed, 77 insertions, 21 deletions
diff --git a/roles/edit/defaults/main.yml b/roles/edit/defaults/main.yml
index ea0fbdb..d57c511 100644
--- a/roles/edit/defaults/main.yml
+++ b/roles/edit/defaults/main.yml
@@ -5,3 +5,6 @@ emacsconf_edit_packages:
- vertico
- magit
- modus-themes
+ - hydra
+ - orderless
+ - projectile
diff --git a/roles/edit/tasks/main.yaml b/roles/edit/tasks/main.yaml
deleted file mode 100644
index f77535f..0000000
--- a/roles/edit/tasks/main.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
----
-- name: Set up Emacs configuration for interactive editing
- template:
- src: emacsconf-edit.el
- dest: "{{ emacs_config_dir }}/emacsconf-edit.el"
-- name: Check if Emacs base configuration already exists
- lineinfile:
- dest: "{{ emacs_config_dir }}/init.el"
- state: present
- regexp: "emacsconf-edit"
- line: "(load-file \"emacsconf-edit.el\")"
diff --git a/roles/edit/tasks/main.yml b/roles/edit/tasks/main.yml
new file mode 100644
index 0000000..f864b23
--- /dev/null
+++ b/roles/edit/tasks/main.yml
@@ -0,0 +1,32 @@
+---
+- name: Check if Emacs is already set up for publishing
+ stat:
+ path: "{{ emacs_config_dir }}/emacsconf-config.el"
+ register: publish_config
+- name: Set up for publishing
+ include_role:
+ name: publish
+ when: not publish_config.stat.exists
+- name: Install Emacs packages
+ shell: |
+ emacs --batch --exec "(progn (require 'package)
+ (let ((packages (seq-remove #'package-installed-p '({% for package in emacsconf_edit_packages %}{{ package }} {% endfor %}))))
+ (when packages
+ (package-refresh-contents)
+ (mapc #'package-install packages))))"
+
+- name: Set up Emacs configuration for interactive editing
+ template:
+ src: emacsconf-edit.el
+ dest: "{{ emacs_config_dir }}/emacsconf-edit.el"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+- name: Check if Emacs base configuration already exists
+ lineinfile:
+ dest: "{{ emacs_config_dir }}/init.el"
+ state: present
+ regexp: "emacsconf-edit"
+ line: "(load-file \"{{ emacs_config_dir }}/emacsconf-edit.el\")"
+ owner: "{{ emacsconf_user }}"
+ group: "{{ emacsconf_group }}"
+ create: yes
diff --git a/roles/edit/templates/emacsconf-edit.el b/roles/edit/templates/emacsconf-edit.el
index 2e360c7..481892b 100644
--- a/roles/edit/templates/emacsconf-edit.el
+++ b/roles/edit/templates/emacsconf-edit.el
@@ -1,7 +1,10 @@
;; {{ ansible_managed }}
-(let ((packages '({% for package in emacsconf_edit_packages %}{{ package }}{% endfor %})))
- (mapc (lambda (package) (unless (package-installed-p package) (package-install package))) packages))
+(progn (require 'package)
+ (let ((packages (seq-remove #'package-installed-p '({% for package in emacsconf_edit_packages %}{{ package }} {% endfor %}))))
+ (when packages
+ (package-refresh-contents)
+ (mapc #'package-install packages))))
;; Configuration
(vertico-mode)
(show-paren-mode)
@@ -19,16 +22,45 @@
(split-window-horizontally)
(magit-status "{{ emacsconf_edit_wiki_dir }}")
(global-auto-revert-mode 1)
-(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
-(projectile-mode +1)
-(setq projectile-completion-system 'default)
-(setq projectile-enable-caching t)
-(setq projectile-indexing-method 'alien)
-(add-to-list 'projectile-globally-ignored-files "node_modules")
-(add-to-list 'projectile-globally-ignored-files ".cache")
-(add-to-list 'projectile-globally-ignored-files "_cache")
+(with-eval-after-load 'projectile
+ (projectile-mode +1)
+ (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
+ (setq projectile-completion-system 'default)
+ (setq projectile-enable-caching t)
+ (setq projectile-indexing-method 'alien)
+ (add-to-list 'projectile-globally-ignored-files "node_modules")
+ (add-to-list 'projectile-globally-ignored-files ".cache")
+ (add-to-list 'projectile-globally-ignored-files "_cache"))
(setq completion-styles '(orderless))
(setq completion-category-defaults nil)
(setq completion-category-overrides '((file (styles orderless))))
+
+(defhydra hydra-emacsconf ()
+ ("e" embark-act "embark")
+ ("t" emacsconf-go-to-talk "talk")
+ ("c"
+ (find-file emacsconf-org-file) "conf.org")
+ ("C"
+ (let ((default-directory (file-name-directory emacsconf-org-file)))
+ (call-interactively #'projectile-find-file))
+ "org dir")
+ ("w"
+ (let ((default-directory emacsconf-directory))
+ (call-interactively #'projectile-find-file))
+ "wiki")
+ ("o" (find-file (expand-file-name (concat emacsconf-year "/organizers-notebook/index.org") emacsconf-directory))
+ "org notes")
+ ("a" (let ((default-directory emacsconf-ansible-directory))
+ (call-interactively #'projectile-find-file))
+ "ansible")
+ ("i" (switch-to-buffer (erc-get-buffer "#emacsconf-org")))
+ ("l" (let ((default-directory "{{ emacsconf_el_dir }}"))
+ (call-interactively #'projectile-find-file))
+ "lisp")
+ ("b" emacsconf-backstage-dired "backstage")
+ ("u" emacsconf-upload-dired "upload"))
+(global-set-key (kbd "C-c e") #'hydra-emacsconf/body)
+
(require 'ox-md)
+(server-start)