Add configuration for emacs-helpful

This commit is contained in:
Tom Willemse 2023-08-15 00:21:24 -07:00
parent 28ff76fc03
commit cb90aa8b43
3 changed files with 97 additions and 4 deletions

View file

@ -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)

View file

@ -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.")))

View file

@ -0,0 +1,38 @@
;;; helpful.el --- Helpful configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2023 Tom Willemse
;; Author: Tom Willemse <tom@ryuslash.org>
;; 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 <https://www.gnu.org/licenses/>.
;;; 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