all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kierin Bell <fernseed@fernseed.me>
To: Liliana Marie Prikler <liliana.prikler@gmail.com>
Cc: "(" <paren@disroot.org>, "Ludovic Courtès" <ludo@gnu.org>,
	cox.katherine.e+guix@gmail.com, 64620@debbugs.gnu.org,
	"Andrew Tropin" <andrew@trop.in>
Subject: [bug#64620] [PATCH] gnu: home: Add home-emacs-service-type.
Date: Fri, 13 Oct 2023 09:59:57 -0400	[thread overview]
Message-ID: <87o7h2lj1e.fsf@fernseed.me> (raw)
In-Reply-To: <0dc55cac713686514f90ec04243f710894451a82.camel@gmail.com> (Liliana Marie Prikler's message of "Fri, 13 Oct 2023 06:30:59 +0200")

Hello,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Hi, Kierin
>
> Am Donnerstag, dem 12.10.2023 um 18:15 -0400 schrieb Kierin Bell:
[...]
> I think you should separate your concerns more clearly.  Rather than
> having home-emacs-service-type take packages and all that other fluff,
> you could just have init-directory as a list of file-likes.  Then you
> can have an init.el-file procedure (or syntax) to take care of
> packages.
>
> e.g.
>   (home-emacs-configuration
>     (emacs %my-custom-emacs)
>     (init-directory
>       (list (init.el-file (emacs-package …) (elisp* …) …))))

Apologies!  I made some confusing errors in the example configurations
in previous message.  In the newer design, the `home-emacs-service-type'
would not directly deal with <emacs-package> objects at all.

Here would be a proper example of the newer semantics:

--8<---------------cut here---------------start------------->8---
(home-environment
 ;; ...
 (services
  (list
   ;; ...
   (service home-emacs-service-type
    (home-emacs-configuration
     (emacs %my-custom-emacs-version)
     (user-emacs-directory "~/.local/state/emacs/")
     (default-init
       (emacs-configuration
        (extra-init
         (elisp* . . . .))))
     ;; ... And possibly:
     (servers
      (list
       (emacs-server-with-packages
        (emacs-server
         (name "server"))
        (list
         (emacs-package
          ;; ...
          )))))))
   (service home-emacs-packages-service-type
    (emacs %my-custom-emacs-version)
    (serializer %emacs-use-package-serializer)
    (packages
     (list
      (emacs-package
       ;; ...
       )
      ;; ...
      ))))))
--8<---------------cut here---------------end--------------->8---


I think you're suggesting flatting the hierarchy from:

--8<---------------cut here---------------start------------->8---
(home-emacs-configuration
 (default-init
   (emacs-configuration
    (extra-init
     (elisp* . . . .))
    (extra-init-files    ; files symlinked and loaded with `load'
     (list
      (local-file "~/guix-config/extras.el")))
    (variables '((foo . #f))))))
--8<---------------cut here---------------end--------------->8---

...Into something like:

--8<---------------cut here---------------start------------->8---
(home-emacs-configuration
 (init-file
  (list
   (elisp* . . .)
   (local-file "~/guix-config/extras.el") ; file contents spliced in
                                          ; or symlinked and loaded?
   (emacs-variables '((foo . #f)))
   (emacs-packages
    (emacs-package
     ;; ...
     )))))
--8<---------------cut here---------------end--------------->8---

This is what David Wilson's patch[1] did. 

There could easily be an explicit `init.el-file' function in there
instead.

> Now, admittedly, snarfing guix packages out of init.el-file might
> become an issue; I haven't thought about how to implement that
> concretely.
>
> The upside is, that you could reuse this structure for servers.  An
> emacs-server would just take another home-emacs-configuration and a
> server name.

The upside of the approach that uses <emacs-configuration> records is
that the encapsulation avoids the weirdness of using a
<home-emacs-configuration> that contains <emacs-server> objects to
create new server objects.  Also, obviously the introspection of
records.

The nesting is confusing, though, and I'd definitely like to work on
that.

A middle ground might be to keep the concept of the
<emacs-configuration> record (maybe even the
`home-emacs-packages-service-type'), but make an `init-file' field smart
enough to accept either Elisp expressions, file-like objects, or
<emacs-configuration> records.

I feel like this may be more of an Elispish way to do things than a
properly Schemic way, but it's a lot simpler to understand.

We could export functions/macros that explicitly convert alists,
<emacs-package> objects, etc. into Elisp, too, in addition.  These may
be useful in other contexts.  But I think it is probably less confusing
and better in principle to chose only one configuration paradigm as the
"proper", standardized way of doing things.

WDYT?

Footnotes:
[1]  https://issues.guix.gnu.org/60753

-- 
Kierin Bell
GPG Key: FCF2 5F08 EA4F 2E3D C7C3  0D41 D14A 8CD3 2D97 0B36




  reply	other threads:[~2023-10-13 14:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14 15:12 [bug#64620] [PATCH] gnu: home: Add home-emacs-service-type fernseed
2023-07-22  2:45 ` 宋文武 via Guix-patches via
2023-08-23 10:01 ` Ludovic Courtès
2023-08-23 16:14   ` Kierin Bell
2023-08-24 12:26 ` Hilton Chain via Guix-patches via
2023-08-24 13:13   ` Kierin Bell
2023-08-24 20:00 ` ( via Guix-patches via
2023-08-26 14:06   ` Kierin Bell
2023-08-28  6:24     ` ( via Guix-patches via
2023-08-28 22:32       ` Kierin Bell
2023-08-29  6:03         ` ( via Guix-patches via
2023-10-11 16:16           ` Ludovic Courtès
2023-10-12 22:15             ` Kierin Bell
2023-10-13  4:30               ` Liliana Marie Prikler
2023-10-13 13:59                 ` Kierin Bell [this message]
2023-08-26 20:01 ` Liliana Marie Prikler
2023-08-28 22:27   ` Kierin Bell
2023-08-29  4:24     ` Liliana Marie Prikler
2023-10-11 16:48 ` Ludovic Courtès
2023-10-12 22:26   ` Kierin Bell
2024-04-01  8:28 ` [bug#64620] Bumping - " Steve George

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7h2lj1e.fsf@fernseed.me \
    --to=fernseed@fernseed.me \
    --cc=64620@debbugs.gnu.org \
    --cc=andrew@trop.in \
    --cc=cox.katherine.e+guix@gmail.com \
    --cc=liliana.prikler@gmail.com \
    --cc=ludo@gnu.org \
    --cc=paren@disroot.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.