From cb90aa8b43b81a5b5082a88fab67828129710670 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 15 Aug 2023 00:21:24 -0700 Subject: Add configuration for emacs-helpful --- oni/home/config/rincewind.scm | 9 ++++++- oni/home/services/emacs.scm | 54 +++++++++++++++++++++++++++++++++++--- oni/home/services/emacs/helpful.el | 38 +++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 oni/home/services/emacs/helpful.el (limited to 'oni') diff --git a/oni/home/config/rincewind.scm b/oni/home/config/rincewind.scm index fcaa67b..a96d0fe 100644 --- a/oni/home/config/rincewind.scm +++ b/oni/home/config/rincewind.scm @@ -68,7 +68,9 @@ #:select (home-dunst-default-service)) #:use-module ((oni home services emacs) #:select (home-emacs-service-type - home-emacs-configuration)) + home-emacs-configuration + home-emacs-helpful-service-type + home-emacs-helpful-configuration)) #:use-module ((oni home services environment) #:select (home-environment-service)) #:use-module ((oni home services flameshot) @@ -316,6 +318,11 @@ "(load custom-file)\n" "(provide 'init)\n" ";;; init.el ends here\n"))))) + (service home-emacs-helpful-service-type + (home-emacs-helpful-configuration + (configurations + (list + (local-file "../services/emacs/helpful.el"))))) (service home-flameshot-service-type) diff --git a/oni/home/services/emacs.scm b/oni/home/services/emacs.scm index 137da8a..6d05821 100644 --- a/oni/home/services/emacs.scm +++ b/oni/home/services/emacs.scm @@ -2,10 +2,13 @@ #:use-module ((gnu services configuration) #:select (serialize-package define-configuration + define-configuration/no-serialization text-config? serialize-text-config)) #:use-module ((gnu packages emacs) #:select (emacs)) + #:use-module ((gnu packages emacs-xyz) + #:select (emacs-helpful)) #:use-module ((gnu home services) #:select (service-type service-extension @@ -23,12 +26,20 @@ #:select (package?)) #:export (home-emacs-service-type - home-emacs-configuration)) + home-emacs-configuration + + home-emacs-helpful-service-type + home-emacs-helpful-configuration)) + +(define-configuration/no-serialization home-emacs-extension + (configurations + (text-config '()) + "The configuration for the extension.")) (define-configuration home-emacs-configuration (package - (package emacs) - "Package to use for setting Emacs") + (package emacs) + "Package to use for setting Emacs") (configurations (text-config '()) "A list of other configuration files to autoload")) @@ -36,6 +47,13 @@ (define (add-emacs-packages config) (list (home-emacs-configuration-package config))) +(define (home-emacs-extensions original-config extension-configs) + (home-emacs-configuration + (inherit original-config) + (configurations + (apply append (home-emacs-configuration-configurations original-config) + (map home-emacs-extension-configurations extension-configs))))) + (define (home-emacs-shepherd-service config) (list (shepherd-service @@ -69,5 +87,35 @@ home-files-service-type home-emacs-config-files))) (compose identity) + (extend home-emacs-extensions) (default-value (home-emacs-configuration)) (description "Install and configure Emacs."))) + +(define-configuration/no-serialization home-emacs-helpful-configuration + (package + (package emacs-helpful) + "Package to use for setting emacs-helpful.") + (configurations + (text-config '()) + "Configuration for emacs-helpful.")) + +(define (add-emacs-helpful config) + (home-emacs-extension + (configurations (home-emacs-helpful-configuration-configurations config)))) + +(define (add-emacs-helpful-packages config) + (list (home-emacs-helpful-configuration-package config))) + +(define home-emacs-helpful-service-type + (service-type + (name 'home-emacs-helpful) + (extensions + (list (service-extension + home-emacs-service-type + add-emacs-helpful) + (service-extension + home-profile-service-type + add-emacs-helpful-packages))) + (compose identity) + (default-value (home-emacs-helpful-configuration)) + (description "Install and configure emacs-helpful."))) diff --git a/oni/home/services/emacs/helpful.el b/oni/home/services/emacs/helpful.el new file mode 100644 index 0000000..59d33de --- /dev/null +++ b/oni/home/services/emacs/helpful.el @@ -0,0 +1,38 @@ +;;; helpful.el --- Helpful configuration -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: local + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; This is my helpful configuration. + +;;; Code: + +(use-package helpful + :config + (global-set-key [remap describe-callable] #'helpful-callable) + (global-set-key [remap describe-function] #'helpful-function) + (global-set-key (kbd "C-h M") #'helpful-macro) + (global-set-key [remap describe-command] #'helpful-command) + (global-set-key [remap describe-key] #'helpful-key) + (global-set-key [remap describe-variable] #'helpful-variable) + (global-set-key (kbd "C-h T") #'helpful-at-point)) + +(provide 'helpful) +;;; helpful.el ends here -- cgit v1.2.3-54-g00ecf