From 25d760efc86c14f490d8adb2a68c324c06b08171 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 3 Oct 2023 22:12:22 -0700 Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=98ace-link=E2=80=99-specific=20set?= =?UTF-8?q?tings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oni/home/config/rincewind.scm | 9 +++++++-- oni/home/services/emacs.scm | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/oni/home/config/rincewind.scm b/oni/home/config/rincewind.scm index d8600eb..a3754e6 100644 --- a/oni/home/config/rincewind.scm +++ b/oni/home/config/rincewind.scm @@ -78,7 +78,8 @@ home-emacs-dashboard-service-type home-emacs-dashboard-configuration home-emacs-eros-service-type - home-emacs-ace-link-service-type)) + home-emacs-ace-link-service-type + home-emacs-ace-link-configuration)) #:use-module ((oni home services environment) #:select (home-environment-service)) #:use-module ((oni home services flameshot) @@ -421,7 +422,11 @@ (service home-emacs-yasnippet-capf-service-type) (service home-emacs-dashboard-service-type) (service home-emacs-eros-service-type) - (service home-emacs-ace-link-service-type) + (service home-emacs-ace-link-service-type + (home-emacs-ace-link-configuration + (default-key "C-S-e") + (goto-address-key "C-S-e") + (org-mode-key "C-S-e"))) (service home-flameshot-service-type) diff --git a/oni/home/services/emacs.scm b/oni/home/services/emacs.scm index a9ba9d7..360ce3b 100644 --- a/oni/home/services/emacs.scm +++ b/oni/home/services/emacs.scm @@ -4,7 +4,9 @@ define-configuration define-configuration/no-serialization text-config? - serialize-text-config)) + serialize-text-config + define-maybe + maybe-value-set?)) #:use-module ((gnu packages emacs) #:select (emacs)) #:use-module ((gnu packages emacs-xyz) @@ -48,6 +50,8 @@ home-emacs-ace-link-service-type home-emacs-ace-link-configuration)) +(define-maybe string) + (define-configuration/no-serialization home-emacs-extension (configurations (text-config '()) @@ -242,6 +246,15 @@ (package (package emacs-ace-link) "Package to use for setting emacs-ace-link.") + (default-key + (string "o") + "Key to use as the default keybinding.") + (goto-address-key + maybe-string + "Key to use (if any) to bind with goto-address-mode.") + (org-mode-key + maybe-string + "Key to use (if any) to bind with org-mode.") (configurations (text-config '()) "Configuration for emacs-ace-link.")) @@ -251,7 +264,22 @@ (configurations (append (list (mixed-text-file "ace-link-config" - "(ace-link-setup-default)\n")) + ";;;;; ace-link-config starts here.\n" + (format #f "(ace-link-setup-default (kbd ~s))~%" + (home-emacs-ace-link-configuration-default-key config)) + (let ((goto-address-key + (home-emacs-ace-link-configuration-goto-address-key config))) + (if (maybe-value-set? goto-address-key) + (string-append (format #f "(defun ace-link-config-set-goto-address-key () (local-set-key (kbd ~s) 'ace-link-addr))~%" goto-address-key) + "(add-hook 'goto-address-prog-mode-hook #'ace-link-config-set-goto-address-key)\n" + "(add-hook 'goto-address-mode-hook #'ace-link-config-set-goto-address-key)\n") + "")) + (let ((org-mode-key + (home-emacs-ace-link-configuration-org-mode-key config))) + (if (maybe-value-set? org-mode-key) + (format #f "(with-eval-after-load 'org (define-key org-mode-map (kbd ~s) 'ace-link-org))\n" org-mode-key) + "")) + ";;;;; ace-link-config ends here.\n")) (home-emacs-ace-link-configuration-configurations config))))) (define (add-emacs-ace-link-packages config)