From: Zain Jabbar <zaijab2000@gmail.com>
To: 58652@debbugs.gnu.org, jbranso@dismail.de
Subject: [bug#58652] Creating home-emacs-service-type
Date: Wed, 19 Oct 2022 15:59:12 -1000 [thread overview]
Message-ID: <CAH+UbWQRoqsgSWpFyb5xjvGsepp0mG86W6g_a4SU04yHFc_mgw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1873 bytes --]
Aloha Guix Development Team,
First submission of a patch to this mail service. Hopefully this
works. I welcome any and all feedback.
Attached is a patch which creates a new file
=/gnu/home/services/emacs.scm= which defines a new service
=home-emacs-service-type= and a configuration for said service
=home-emacs-configuration=. The configuration contains a list of
packages to add to the home-profile, and a list of expressions to add
into Emacs' =init.el= and =early-init.el=.
Here is an example of a home environment file which:
Adds the following packages:
- =bash=
- =emacs-next=
- =emacs-debbugs=
- =emacs-evil=
- =emacs-paredit=
- =emacs-anzu=
Overwrites the =.config/emacs/init.el= with:
#+BEGIN_SRC emacs-lisp
(evil-mode 1)
#+END_SRC
Overwrites the =.config/emacs/early-init.el= with:
#+BEGIN_SRC emacs-lisp
(setq warning-suppress-log-types '((comp) (comp))) (setq
warning-suppress-types '((comp) (comp)))
#+END_SRC
#+BEGIN_SRC scheme
(use-modules (gnu home services emacs)
(gnu home)
(gnu packages)
(ice-9 pretty-print)
(gnu services))
(define-public minimal-home-environment
(home-environment
(services
(list
(service home-emacs-service-type
(home-emacs-configuration
(packages
(list
(specification->package "bash")
(specification->package "emacs-next")
(specification->package "emacs-debbugs")
(specification->package "emacs-evil")
(specification->package "emacs-paredit")
(specification->package "emacs-anzu")))
(init '((evil-mode 1)))
(early-init '((setq warning-suppress-log-types '((comp) (comp)))
(setq warning-suppress-types '((comp) (comp)))))))))))
minimal-home-environment
#+END_SRC
Saving this text into a file =minimal-working-example.scm= allows us
to run this configuration with =guix home -N --share=/tmp container
./minimal-working-example.scm=.
--
Mahalo,
Zain Jabbar
[-- Attachment #2: home-emacs-service-type.patch --]
[-- Type: text/x-patch, Size: 2630 bytes --]
diff --git a/gnu/home/services/emacs.scm b/gnu/home/services/emacs.scm
deleted file mode 100644
index a3951c2a85..0000000000
--- a/gnu/home/services/emacs.scm
+++ /dev/null
@@ -1,63 +0,0 @@
-;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2022 Zain Jabbar <zaijab2000@gmail.com>
-;;;
-;;; This file is part of GNU Guix.
-;;;
-;;; GNU Guix 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.
-;;;
-;;; GNU Guix 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 GNU Guix. If not, see <http://www.gnu.org/licenses/>.
-
-(define-module (gnu home services emacs)
- #:use-module (gnu home)
- #:use-module (gnu packages)
- #:use-module (gnu services)
- #:use-module (gnu home services)
- #:use-module (gnu services)
- #:use-module (gnu services configuration)
- #:use-module (guix gexp)
-
- #:export (home-emacs-service-type
- home-emacs-configuration))
-
-(define file-likes? (list-of file-like?))
-
-(define-configuration/no-serialization home-emacs-configuration
- (packages
- (file-likes (list (specification->package "emacs")))
- "The packages this configuration will add to home-profile. Usually these will be emacs-* packages.")
- (early-init
- (list '())
- "A list whose contents will inserted into @file{$XDG_CONFIG_HOME/emacs/early-init.el}")
- (init
- (list '())
- "A list whose contents will inserted into @file{$XDG_CONFIG_HOME/emacs/init.el}"))
-
-(define home-emacs-service-type
- (service-type (name 'emacs-configuration)
- (extensions
- (list (service-extension
- home-profile-service-type
- (lambda (config) (home-emacs-configuration-packages config)))
- (service-extension
- home-xdg-configuration-files-service-type
- (lambda (config)
- (list
- `("emacs/early-init.el"
- ,(scheme-file "early-init.el"
- (home-emacs-configuration-early-init config)
- #:splice? #:t))
- `("emacs/init.el"
- ,(scheme-file "init.el"
- (home-emacs-configuration-init config)
- #:splice? #:t)))))))
- (default-value (home-emacs-configuration))
- (description "Configures Emacs and installs packages to home-profile.")))
next reply other threads:[~2022-10-20 13:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 1:59 Zain Jabbar [this message]
2022-10-20 12:53 ` [bug#58652] Creating home-emacs-service-type Liliana Marie Prikler
2022-10-20 21:30 ` Zain Jabbar
2022-10-21 6:05 ` Liliana Marie Prikler
2022-10-21 15:42 ` Joshua Branson via Guix-patches via
2022-10-22 7:09 ` Zain Jabbar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAH+UbWQRoqsgSWpFyb5xjvGsepp0mG86W6g_a4SU04yHFc_mgw@mail.gmail.com \
--to=zaijab2000@gmail.com \
--cc=58652@debbugs.gnu.org \
--cc=jbranso@dismail.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).