From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id iKeOAGPZ5WSD3gAASxT56A (envelope-from ) for ; Wed, 23 Aug 2023 12:03:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id eF1/AGPZ5WQKJAAA9RJhRA (envelope-from ) for ; Wed, 23 Aug 2023 12:03:15 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8C5424584E for ; Wed, 23 Aug 2023 12:03:14 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=r0pG5iwA; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692784994; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=5PTwwTikLnFalgK5yBgyBOIKzmmEX9KheoCHiT1mq3I=; b=Uf+7WBZw/pa7Yt77dIQRjQuEn1OkkW/cJZm6FRS1/NvV6eaplMc7CrcF3ywjuUWsjeGM+H JY6y7g1bHtCjAi6V1LKXHDuGBtPZ/v4W4K4o8AZENSSxk2cJOcH3ASRL28T/jdQsrk2Jdz EulpnjePWOPrNvRoR52XfS21tFSCyY7m7tJbu5lUDXsKpCksCdhUOSXIubjFxYY0X86KMG 8ZNVi6ilbXvsE/+iIKP5xkKRhU46FAxwq0ZsOOqiZnLuTVUaar114ROWWtno6WUsu3L39/ BeCrDHwp/JlR4dd6lECXR/TaV5YMhP88Eztd7pj3vHeRWQ9mqMsRTsWYwNDs7Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=r0pG5iwA; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692784994; a=rsa-sha256; cv=none; b=Ffav4vcDRCCHqijS9wbq20NXIgc8pH5i/LYHjrr8mrUeD27oZd04oOK+MHn4HemhFHwAU9 aXEtRUFxrf1t6G+srdgmob3XUfBP0qkSbfDyxGgZdf+nv9/Tp0tdMIRxsbWWgpxBTtFyUo E3vdAYscvCh2QWHq4nRp1PNCf/i4eCZefIe7io0wjp8HrqchUZNFHSEXOWkqE/8t2P9Ox9 An4qAY5EW6r14qDomgAohNMMSplPZXchWpt8Iv2YnRn3wGN4XUWqCL7CFl/Ni4Vt1jD3Br yUGZrh+At7lP7TmaCCPkBb1nH1Bxby/TtOlLA2aTAonSxDH0oif0XB+LGHNFZQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYkhZ-0007nk-2s; Wed, 23 Aug 2023 06:03:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYkhW-0007nG-Sd for guix-patches@gnu.org; Wed, 23 Aug 2023 06:02:59 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYkhW-0005kQ-KL for guix-patches@gnu.org; Wed, 23 Aug 2023 06:02:58 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qYkhZ-0003Xd-Sq for guix-patches@gnu.org; Wed, 23 Aug 2023 06:03:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64620] [PATCH] gnu: home: Add home-emacs-service-type. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 23 Aug 2023 10:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64620 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: fernseed@fernseed.me Cc: , 64620@debbugs.gnu.org Received: via spool by 64620-submit@debbugs.gnu.org id=B64620.169278494213556 (code B ref 64620); Wed, 23 Aug 2023 10:03:01 +0000 Received: (at 64620) by debbugs.gnu.org; 23 Aug 2023 10:02:22 +0000 Received: from localhost ([127.0.0.1]:32865 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYkgv-0003WZ-RP for submit@debbugs.gnu.org; Wed, 23 Aug 2023 06:02:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYkgt-0003WK-34 for 64620@debbugs.gnu.org; Wed, 23 Aug 2023 06:02:20 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYkgh-0005ZT-Is; Wed, 23 Aug 2023 06:02:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=5PTwwTikLnFalgK5yBgyBOIKzmmEX9KheoCHiT1mq3I=; b=r0pG5iwA3t5XZKNS8vxX VjzsM2UjJthlrCvVLPZ/8Zl5OD/IgYbfHFJrlT7fJjwxCz4fdnQXoQr7IqwJzScJgIFqG2LrJRKdb 5vMxR6Z1p/cyKAaWjRKjIdlo2wJnRRmbBKb2MY6R3cyZCGts/ZzSRd1go9uMC1ByXif0RY3YlWm7g yyxPKgcILvDuAmtg7+R9txJHsP9uIglLiMFEuIAj1XO0zCt/NwQ7Zwm8VOoJukLwbDVSa7r9hlazX eK8WHk4tIE+Vb4mV7FhMzzAqiKuwA1OJ31Vr2vjJJkMqmqxw9fM2/aO/P3FtXWcKj+657St4DuuL/ srzLoQ7dxabTRQ==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <0173e076aafb6ec389a7ebca5d56b7f4e8a02b6e.1689347338.git.fernseed@fernseed.me> Date: Wed, 23 Aug 2023 12:01:51 +0200 In-Reply-To: <0173e076aafb6ec389a7ebca5d56b7f4e8a02b6e.1689347338.git.fernseed@fernseed.me> (fernseed@fernseed.me's message of "Fri, 14 Jul 2023 11:12:31 -0400") Message-ID: <87v8d613hs.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx2.migadu.com X-Migadu-Spam-Score: -3.91 X-Spam-Score: -3.91 X-Migadu-Queue-Id: 8C5424584E X-TUID: 9rhqzaJnhiDT Hi Kierin, This is a truly impressive piece of work! fernseed@fernseed.me skribis: > This patch builds on patches from ( and David Wilson for a > `home-emacs-service-type' (https://issues.guix.gnu.org/58693, > https://issues.guix.gnu.org/60753, https://issues.guix.gnu.org/62549). > > Many of the features of the prior patches have been included, but the > major focus here is to configure Emacs in Scheme rather than symlinking > to existing configuration files. OK, interesting. This seems to be one of the main questions: how far should we go on the Scheme side? In , unmatched-paren chose to not generate elisp at all from Scheme. The advantage is that the implementation is simpler; as a user, the model one has to have in mind is also simpler: you=E2=80=99re still configuring most things the tradition= al way in elisp. That=E2=80=99s also its downside: you have to do plumbing on= the elisp side, when Guix Home in some cases would know what to do. I don=E2=80=99t have the answer and I=E2=80=99m not sure what I=E2=80=99d p= refer, but I=E2=80=99m trying to see the tradeoffs and to map out the design space. > Here are some of the broad strokes: > > * The following record types have been introduced to encapsulate > configuration for Emacs: `emacs-configuration' (for general > configuration), `emacs-package' (for package-specific configuration), > `emacs-keymap' (for configuration of local keymaps), and > `emacs-server' (for configuration of Emacs servers). Why special-case keymaps, of all the things one might one to configure in Emacs? I understand it=E2=80=99s one of the first things one may want to tweak, but then why not add as well, etc.; IOW, where do we draw the line? > * Most configuration fields are either flat lists or alists that are > considerably abstracted from their final serialized Elisp > representation, but escape hatches are provided for both pulling in > existing configuration files and specifying s-expressions directly. Are seasoned Emacsers not going to be frustrated because of this? :-) They might prefer to have full access to elisp. > * All serialized Elisp is pretty-printed much how we would expect to see > it in Emacs (for example, with proper indentation according to the > `lisp-indent-function' symbol property, etc.). This has been > accomplished by adding a new keyword argument to > `pretty-print-with-comments' from `(guix read-print)', among other > improvements. Fun. I=E2=80=99d like to see how we can avoid spreading elisp conditionals= in (guix read-print). > * Emacs package configuration can either be serialized as `use-package' > forms or as equivalent, more minimalist s-expressions. Users can > define their own package serializers, too. > > * For specifying s-expressions, an "Elisp expression" syntax has been > implemented that is essentially a lighter-weight version G-expressions. > (I try to explain why this is helpful in the documentation.) > > * A reader extension has been implemented that allows for "Elisp > expressions" to be specified directly with Elisp read syntax, and > Scheme values (including file-like objects or G-expressions) can in > turn be "unquoted" within that Elisp code. Also, comments and > whitespace can be included within the Elisp code via the `#;' > (comment), `#>' (newline), and `;^L' (page break) forms. Great that you=E2=80=99re putting (language elisp parser) to good use! > * Each Emacs server has its own user init and early init files, which > can optionally inherit configuration from the init files used by > non-server Emacsen. Each server can also inherit the "main" > `user-emacs-directory', or it can use its own subdirectory. > > * The `home-emacs-service-type' can be extended, with subordinate > configuration records being merged intelligently when possible. Very nice. > * A utility function has been provided for generating the aforementioned > Scheme records from an existing Emacs init file: > `elisp-file->home-emacs-configuration'. Neat; perhaps =E2=80=98guix home import=E2=80=99 could use it? > (define %gnus-init-file > (elisp-file "gnus.el" > (list > (elisp (setq gnus-select-method '(nnnil ""))) > (elisp (setq gnus-secondary-select-methods > '((nnml "") > (nntp "news.gmane.io")))) > (elisp (setq mail-sources > '((imap :server "mail.example.net" > :user "user@example.net" > :port 993 > :stream tls)))) > ;; Elisp reader extension > #%(define-key global-map [remap compose-mail] #;comment > '#$%my-function-name nil)))) Could I write: #%(progn (setq x =E2=80=A6) (setq y =E2=80=A6) (define-key =E2=80=A6)) ? That would seem nicer. #%(body =E2=80=A6) is short for (elisp body =E2=80=A6) right? [...] > (configured-packages > (list > (emacs-package > (name 'windmove) > ;; Autoload a function used by `my--display-buffer-down'. > (autoloads '(windmove-display-in-direction)) > (keys-override > '(("C-M-" . windmove-left) > ("C-M-" . windmove-right) > ("C-M-" . windmove-up) > ("C-M-" . windmove-down) > ("C-x " > . my--display-buffer-down))) > (keys-local > (list > (emacs-keymap > (name 'windmove-repeat-map) > (repeat? #t) > (keys '(("" . windmove-left) > ("" . windmove-right) > ("" . windmove-up) > ("" . windmove-down)))))) My first reaction is that I don=E2=80=99t see myself my 2K lines (or a subs= et thereof) of .emacs and .gnus in that style. I can foresee potential benefits in terms of composability, but the barrier to entry looks too high. WDYT? > Finally, unit tests have been added for the new `(guix read-print)' > functionality, and for the "Elisp expression" syntax. I couldn't make > unit tests for anything that builds derivations serializing Elisp, > because '%bootstrap-guile' is apparently too old to load `(guix > read-print)' on the derivation side. But most of this has gotten quite > a bit of testing, as all of my personal Emacs config is now generated > from Scheme. I think you could write tests using =E2=80=98guix home container=E2=80=99 a= nd the host=E2=80=99s store, similar to what =E2=80=98tests/guix-home.sh=E2=80=99 is doing. We d= on=E2=80=99t have a testing strategy for Home services yet, but we should definitely work on it. That=E2=80=99s it for my initial feedback. I hope others in the Home and E= macs teams will chime in! Thanks, Ludo=E2=80=99.