From edfc8c25582b5fc0673f36b7af121ab8496bba24 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 29 Aug 2023 22:21:30 -0700 Subject: [PATCH] Add emacs-yasnippet-capf to my configuration --- oni/home/config/rincewind.scm | 6 +++-- oni/home/services/emacs.scm | 41 ++++++++++++++++++++++++++++++++++- oni/packages/emacs.scm | 22 +++++++++++++++++++ 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/oni/home/config/rincewind.scm b/oni/home/config/rincewind.scm index 6875046..540e26e 100644 --- a/oni/home/config/rincewind.scm +++ b/oni/home/config/rincewind.scm @@ -72,7 +72,8 @@ #:select (home-emacs-service-type home-emacs-configuration home-emacs-helpful-service-type - home-emacs-helpful-configuration)) + home-emacs-helpful-configuration + home-emacs-yasnippet-capf-service-type)) #:use-module ((oni home services environment) #:select (home-environment-service)) #:use-module ((oni home services flameshot) @@ -325,7 +326,8 @@ (home-emacs-helpful-configuration (configurations (list - (local-file "../services/emacs/helpful.el"))))) + (local-file "../services/emacs/oni-helpful.el"))))) + (service home-emacs-yasnippet-capf-service-type) (service home-flameshot-service-type) diff --git a/oni/home/services/emacs.scm b/oni/home/services/emacs.scm index 6d05821..c50809f 100644 --- a/oni/home/services/emacs.scm +++ b/oni/home/services/emacs.scm @@ -25,11 +25,17 @@ #:use-module ((guix packages) #:select (package?)) + #:use-module ((oni packages emacs) + #:select (emacs-yasnippet-capf)) + #:export (home-emacs-service-type home-emacs-configuration home-emacs-helpful-service-type - home-emacs-helpful-configuration)) + home-emacs-helpful-configuration + + home-emacs-yasnippet-capf-service-type + home-emacs-yasnippet-capf-configuration)) (define-configuration/no-serialization home-emacs-extension (configurations @@ -119,3 +125,36 @@ (compose identity) (default-value (home-emacs-helpful-configuration)) (description "Install and configure emacs-helpful."))) + +(define-configuration/no-serialization home-emacs-yasnippet-capf-configuration + (package + (package emacs-yasnippet-capf) + "Package to use for setting emacs-yasnippet-capf.") + (configurations + (text-config '()) + "Configuration for emacs-yasnippet-capf.")) + +(define (add-emacs-yasnippet-capf config) + (home-emacs-extension + (configurations + (append + (list (mixed-text-file "yasnippet-capf-config" + "(with-eval-after-load 'minibuffer (add-to-list 'completions-at-point-functions #'yasnippet-capf))\n")) + (home-emacs-yasnippet-capf-configuration-configurations config))))) + +(define (add-emacs-yasnippet-capf-packages config) + (list (home-emacs-yasnippet-capf-configuration-package config))) + +(define home-emacs-yasnippet-capf-service-type + (service-type + (name 'home-yasnippet-capf) + (extensions + (list (service-extension + home-emacs-service-type + add-emacs-yasnippet-capf) + (service-extension + home-profile-service-type + add-emacs-yasnippet-capf-packages))) + (compose identity) + (default-value (home-emacs-yasnippet-capf-configuration)) + (description "Install and configure emacs-yasnippet-capf."))) diff --git a/oni/packages/emacs.scm b/oni/packages/emacs.scm index 008f283..526f96c 100644 --- a/oni/packages/emacs.scm +++ b/oni/packages/emacs.scm @@ -390,3 +390,25 @@ key features.") new-theme for a while. I couldn't think of a name so I named it after him.") (license license:gpl3+)))) +(define-public emacs-yasnippet-capf + (let ((commit "40654214db7a44db3a99321447632b43a10fae57") + (revision "0")) + (package + (name "emacs-yasnippet-capf") + (version (git-version "7.0.0" revision commit)) + (source + (origin + (uri (git-reference + (url "https://github.com/elken/yasnippet-capf.git") + (commit commit))) + (method git-fetch) + (file-name (git-file-name name version)) + (sha256 + (base32 "1kywl7jblrmixr0vwycpil5hyk4p5qlc3gxg9w25xga4jj91r663")))) + (propagated-inputs + (list emacs-yasnippet)) + (build-system emacs-build-system) + (home-page "https://github.com/elken/yasnippet-capf") + (synopsis "Completion-At-Point Extension for YASnippet") + (description "A simple capf (Completion-At-Point Function) for completing yasnippet snippets.") + (license license:gpl3))))