Add ‘ace-link’-specific settings

This commit is contained in:
Tom Willemse 2023-10-03 22:12:22 -07:00
parent f1e8928c6d
commit 25d760efc8
2 changed files with 37 additions and 4 deletions

View file

@ -78,7 +78,8 @@
home-emacs-dashboard-service-type home-emacs-dashboard-service-type
home-emacs-dashboard-configuration home-emacs-dashboard-configuration
home-emacs-eros-service-type 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) #:use-module ((oni home services environment)
#:select (home-environment-service)) #:select (home-environment-service))
#:use-module ((oni home services flameshot) #:use-module ((oni home services flameshot)
@ -421,7 +422,11 @@
(service home-emacs-yasnippet-capf-service-type) (service home-emacs-yasnippet-capf-service-type)
(service home-emacs-dashboard-service-type) (service home-emacs-dashboard-service-type)
(service home-emacs-eros-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) (service home-flameshot-service-type)

View file

@ -4,7 +4,9 @@
define-configuration define-configuration
define-configuration/no-serialization define-configuration/no-serialization
text-config? text-config?
serialize-text-config)) serialize-text-config
define-maybe
maybe-value-set?))
#:use-module ((gnu packages emacs) #:use-module ((gnu packages emacs)
#:select (emacs)) #:select (emacs))
#:use-module ((gnu packages emacs-xyz) #:use-module ((gnu packages emacs-xyz)
@ -48,6 +50,8 @@
home-emacs-ace-link-service-type home-emacs-ace-link-service-type
home-emacs-ace-link-configuration)) home-emacs-ace-link-configuration))
(define-maybe string)
(define-configuration/no-serialization home-emacs-extension (define-configuration/no-serialization home-emacs-extension
(configurations (configurations
(text-config '()) (text-config '())
@ -242,6 +246,15 @@
(package (package
(package emacs-ace-link) (package emacs-ace-link)
"Package to use for setting 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 (configurations
(text-config '()) (text-config '())
"Configuration for emacs-ace-link.")) "Configuration for emacs-ace-link."))
@ -251,7 +264,22 @@
(configurations (configurations
(append (append
(list (mixed-text-file "ace-link-config" (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))))) (home-emacs-ace-link-configuration-configurations config)))))
(define (add-emacs-ace-link-packages config) (define (add-emacs-ace-link-packages config)