From unknown Wed Jun 18 23:12:48 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#60753 <60753@debbugs.gnu.org> To: bug#60753 <60753@debbugs.gnu.org> Subject: Status: [PATCH] gnu: home: Add home-emacs-service-type. Reply-To: bug#60753 <60753@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:12:48 +0000 retitle 60753 [PATCH] gnu: home: Add home-emacs-service-type. reassign 60753 guix-patches submitter 60753 David Wilson severity 60753 normal tag 60753 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 12 09:11:27 2023 Received: (at submit) by debbugs.gnu.org; 12 Jan 2023 14:11:27 +0000 Received: from localhost ([127.0.0.1]:45047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFyIg-0002Vp-JQ for submit@debbugs.gnu.org; Thu, 12 Jan 2023 09:11:27 -0500 Received: from lists.gnu.org ([209.51.188.17]:38814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFyIe-0002VZ-8W for submit@debbugs.gnu.org; Thu, 12 Jan 2023 09:11:25 -0500 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 1pFyIS-0007YU-4E for guix-patches@gnu.org; Thu, 12 Jan 2023 09:11:12 -0500 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFyIN-0007gb-3J for guix-patches@gnu.org; Thu, 12 Jan 2023 09:11:11 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 5874F3200908 for ; Thu, 12 Jan 2023 09:02:08 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 12 Jan 2023 09:02:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daviwil.com; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm1; t=1673532127; x=1673618527; bh=2iVUYUp0lF Kdrz0Zg6rgAW+W9myrJCnDelp4qlsgSuQ=; b=3yBV8dh43mQ2lnVfV00rzCmxDE 0LwkKZCc4eSLF8+NgPPMDZiGROg6n90111Krod+p8JrQyVw4GBN04dbQ6lCHE6aa z7BVAF3gv9eATU4Fc82a8hXfqUHMmdKLLgKNfiQPNnzWsRn6VbNlkVrRFz6UAYQ8 SZpcrcOIuQ1eaUDftgU5XtqU9aPM9x9E4u4kiAm04ZxNzxK3hWyEs45PzrKh5850 XI2mz2Huet14K2MWUmVpC/7CSi4hHSzyX3yjJWkwN6udguEA+D/ATwJ09O83opzj ub2VMRthBU1cs7QEhhw/r0RolYkNQRlaDYgBZAOMKCxuRXx032Dzjl75XUYw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1673532127; x=1673618527; bh=2iVUYUp0lFKdrz0Zg6rgAW+W9myr JCnDelp4qlsgSuQ=; b=MVgBk6zV7TsX8feQT7KOUmrne+yo0po3BBcC4sJv0TS/ 87oPRYfFLXdo4SqiRxLZkT6aX4on1gisVT92FSRk65NxhR39PgWx1FmghyXp/CPS usQ/5auztfoc3wnucLPeVnLrv+hfFsFMWHph6raaurbPIYhAQs2tVUEnYTH3nyjG FG3WJwVVsnKGi2oz1/aNEG2frPyhIoKqLhrb/qZ3l98xjtaRsVjqagmIxV/HBRl3 IDoEaDJ+hSAOMmVT10CteJehMsZcZvdODPXmnClGR0AKZFAVUb8qW3NoXu7l1E4p Sx0vkt0CV1nw4qPQJibZYTc/33nf07hO2/BGPiOzAw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrleeigdehlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfgfhvffufffkgggtgfesthhqredttd erjeenucfhrhhomhepffgrvhhiugcuhghilhhsohhnuceouggrvhhiugesuggrvhhifihi lhdrtghomheqnecuggftrfgrthhtvghrnhepkeefudfhkedvueeikeekteejkedvjeejge dtfffgffejvdejueefhfejhfeutdetnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepuggrvhhiugesug grvhhifihilhdrtghomh X-ME-Proxy: Feedback-ID: iba684179:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 12 Jan 2023 09:02:06 -0500 (EST) User-agent: mu4e 1.8.11; emacs 28.2 From: David Wilson To: guix-patches@gnu.org Subject: [PATCH] gnu: home: Add home-emacs-service-type. Date: Thu, 12 Jan 2023 16:01:18 +0200 Message-ID: <87edrzzw9w.fsf@daviwil.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: none client-ip=64.147.123.20; envelope-from=david@daviwil.com; helo=wout4-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This commit continues work by ( to add a home-emacs-service-type for the purpose of configuring Emacs. The goal here is not to configure Emacs with Scheme forms, but to make it possible to assemble init.el and early-init.el using files from one's own p= ersonal configuration and other Emacs Lisp snippets for further customization. The simplest usage of the service would be to use simple strings or local files to build init.el and early-init.el: (home-environment (services (list (service home-emacs-service-type (home-emacs-configuration (init-file (list (local-file "init.el"))) (early-init-file '(";; This is early-init.el!\n")))= )))) The `emacs-variable' function can be used to generate a g-expression which will produce a `setq' form inside of an init file: (home-emacs-configuration (init-file (list (emacs-variables '((my/font-size . 24) (my/tab-width . 2) (inhibit-startup-message . #t))) (local-file "init.el")))) If you have an existing folder of Emacs Lisp files that you `require' into your configuration, you can use the `load-paths' field to pull in the entire folder or reference the existing files on your system: (home-emacs-configuration (init-file (list "(require 'my-init)")) (load-paths (list (local-file "emacs-modules" #:recursive #t)))) Since Emacs loves to write files to `user-emacs-directory', we must provide= a writeable path for it so that Emacs doesn't try to write files into the read-only store. The `user-emacs-directory' field can be used to customize that; it defaults to `~/.cache/emacs'. Other services can extend home-emacs-service-type with the home-emacs-extension type to add further configuration snippets, packages, = and load paths: (home-environment (services (list (service home-emacs-service-type (home-emacs-configuration (init-file (list "(require 'my-module)\n")))) (simple-service 'home-emacs-extension-one home-emacs-service-type (home-emacs-extension (packages (list (specification->package "emacs-= evil"))) (init-file (list "(evil-mode +1)\n"))))))) Co-authored-by: ( --- doc/guix.texi | 77 +++++++++++++++ gnu/home/services/emacs.scm | 188 ++++++++++++++++++++++++++++++++++++ gnu/local.mk | 1 + 3 files changed, 266 insertions(+) create mode 100644 gnu/home/services/emacs.scm diff --git a/doc/guix.texi b/doc/guix.texi index 751d0957d8..62fefde1ea 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -111,6 +111,7 @@ Copyright @copyright{} 2022 (@* Copyright @copyright{} 2022 John Kehayias@* Copyright @copyright{} 2022 Ivan Vilata-i-Balaguer@* Copyright @copyright{} 2023 Giacomo Leidi@* +Copyright @copyright{} 2023 David Wilson@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -41061,6 +41062,7 @@ services)}. * Shepherd: Shepherd Home Service. Managing User's Dae= mons. * SSH: Secure Shell. Setting up the secu= re shell client. * Desktop: Desktop Home Services. Services for graphi= cal environments. +* Emacs: Emacs Home Services. Services for config= uring Emacs. * Guix: Guix Home Services. Services for Guix. @end menu @c In addition to that Home Services can provide @@ -41914,6 +41916,81 @@ The package providing the @code{/bin/dbus-daemon} = command. @end table @end deftp +@node Emacs Home Services +@subsection Emacs Home Services + +@defvr {Scheme Variable} home-emacs-service-type +This is the service type for configuring the Emacs text editor. It +enables you to assemble @file{init.el} and @file{early-init.el} files +from snippets in your home configuration and other Emacs Lisp files you +have in your personal configuration folder. + +This service can be extended using the @code{home-emacs-extension} type. + +Note that if you have an existing @file{~/.emacs} and/or +@file{~/.emacs.d}, the configuration aspect of this service will not be +loaded, as the former location takes precedence over +@file{~/.config/emacs}. This service uses the latter path in the +interest of cleanliness. To migrate to the XDG directory, run these +commands: + +@example +$ cp ~/.emacs.d $XDG_CONFIG_HOME/emacs +$ cp ~/.emacs $XDG_CONFIG_HOME/emacs/init.el +@end example +@end defvr + +@deftp {Data Type} home-emacs-configuration +The configuration record for @code{home-emacs-service-type}. + +@table @asis +@item @code{emacs} (default: @code{emacs}) +The package providing the @file{/bin/emacs} command. + +@item @code{packages} (default: @code{'()}) +Additional packages required by the Emacs configuration. + +@item @code{user-emacs-directory} (default: @file{~/.cache/emacs}) +The directory beneath which additional per-user Emacs-specific files are p= laced. + +@item @code{init-file} (default: @code{'()}) +Configuration text or files to include in @file{init.el}. + +@item @code{early-init-file} (default: @code{'()}) +Configuration text or files to include in @file{early-init.el}. + +@item @code{load-paths} (default: @code{'()}) +Additional load paths to add to Emacs' @code{load-path} variable. Lines +will be inserted at the beginning of @file{early-init.el}. + +@item @code{native-compile?} (default: @code{#f}) +Whether to compile all @code{packages}, using the provided @code{emacs} +package in place of @code{emacs-minimal}, which will enable native +compilation if the @code{emacs} package supports it. All +non-@code{-minimal} Emacs packages at version 28 or above should support +native compilation. +@end table +@end deftp + +@deftp {Data Type} home-emacs-extension +The extension record for @code{home-emacs-service-type}. + +@table @asis +@item @code{packages} (default: @code{'()}) +Additional packages required by the Emacs configuration. + +@item @code{init-file} (default: @code{'()}) +Configuration text or files to include in @file{init.el}. + +@item @code{early-init-file} (default: @code{'()}) +Configuration text or files to include in @file{early-init.el}. + +@item @code{load-paths} (default: @code{'()}) +Additional load paths to add to Emacs' @code{load-path} variable. Lines +will be inserted at the beginning of @file{early-init.el}. +@end table +@end deftp + @node Guix Home Services @subsection Guix Home Services diff --git a/gnu/home/services/emacs.scm b/gnu/home/services/emacs.scm new file mode 100644 index 0000000000..45b4f2a5d6 --- /dev/null +++ b/gnu/home/services/emacs.scm @@ -0,0 +1,188 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2022 ( +;;; Copyright =C2=A9 2023 David Wilson +;;; +;;; 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 . + +(define-module (gnu home services emacs) + #:use-module (gnu home services) + #:autoload (gnu packages emacs) (emacs-minimal + emacs) + #:use-module (gnu services configuration) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix records) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + + #:export (emacs-variables + home-emacs-configuration + home-emacs-extension + home-emacs-service-type)) + +(define list-of-file-likes? + (list-of file-like?)) + +(define (string-or-file-like? val) + (or (string? val) + (file-like? val))) + +(define list-of-string-or-file-likes? + (list-of string-or-file-like?)) + +(define-configuration/no-serialization home-emacs-configuration + (emacs + (file-like emacs) + "The package providing the @file{/bin/emacs} command.") + (packages + (list-of-file-likes '()) + "Additional packages required by the Emacs configuration.") + (user-emacs-directory + (string "~/.cache/emacs") + "Directory beneath which additional per-user Emacs-specific files are p= laced.") + (init-file + (text-config '()) + "Configuration text or files to include in init.el.") + (early-init-file + (text-config '()) + "Configuration text or files to include in early-init.el.") + (load-paths + (list-of-string-or-file-likes '()) + "Additional load paths to add to Emacs' @code{load-path} variable. Lin= es +will be inserted at the beginning of early-init.el.") + (native-compile? + (boolean #f) + "Whether to compile the @code{packages} using the Emacs package +provided as the value of the @code{emacs} field, which will enable +native compilation if the @code{emacs} package supports it.")) + +(define (home-emacs-profile-packages config) + (cons (home-emacs-configuration-emacs config) + (home-emacs-configuration-packages config))) + +(define (home-emacs-transformed-packages config) + (map (if (home-emacs-configuration-native-compile? config) + (package-input-rewriting + `((,emacs-minimal + . ,(home-emacs-configuration-emacs config)))) + identity) + (let ((packages (home-emacs-configuration-packages config))) + (concatenate + (cons packages + (map (compose (cute map second <>) + package-transitive-propagated-inputs) + packages)))))) + +(define (serialize-emacs-load-paths config) + #~(string-append + ";; Additional load paths\n" + #$@(map (lambda (load-path) + #~(format #f "(add-to-list 'load-path \"~a\")" #$load-path)) + (home-emacs-configuration-load-paths config)) + "\n\n")) + +(define (serialize-emacs-user-directory config) + (format #f + ";; Set the `user-emacs-directory` to a writeable path\n(setq us= er-emacs-directory \"~a\")\n\n" + (home-emacs-configuration-user-emacs-directory config))) + +(define (home-emacs-xdg-configuration-files config) + `(("emacs/early-init.el" + ,(apply mixed-text-file + (cons* "early-init.el" + (serialize-emacs-load-paths config) + (serialize-emacs-user-directory config) + (home-emacs-configuration-early-init-file config)))) + ("emacs/init.el" + ,(apply mixed-text-file + (cons "init.el" + (home-emacs-configuration-init-file config)))))) + +(define-configuration/no-serialization home-emacs-extension + (packages + (list-of-file-likes '()) + "Additional packages required by the Emacs configuration.") + (init-file + (text-config '()) + "Configuration text or files to include in init.el.") + (early-init-file + (text-config '()) + "Configuration text or files to include in early-init.el.") + (load-paths + (list-of-string-or-file-likes '()) + "Additional load paths to add to Emacs' @code{load-path} variable. Lin= es +will be inserted at the beginning of early-init.el.")) + +(define (home-emacs-extensions original-config extension-configs) + (match-record original-config + (packages load-paths init-file early-init-file) + (home-emacs-configuration + (inherit original-config) + (packages + (append packages + (append-map + home-emacs-extension-packages extension-configs))) + (init-file + (append init-file + (append-map + home-emacs-extension-init-file extension-configs))) + (early-init-file + (append early-init-file + (append-map + home-emacs-extension-early-init-file extension-configs))) + (load-paths + (append load-paths + (append-map + home-emacs-extension-load-paths extension-configs)))))) + +(define home-emacs-service-type + (service-type + (name 'home-emacs) + (extensions + (list (service-extension + home-profile-service-type + home-emacs-profile-packages) + (service-extension + home-shepherd-service-type + home-emacs-shepherd-services) + (service-extension + home-xdg-configuration-files-service-type + home-emacs-xdg-configuration-files))) + (default-value (home-emacs-configuration)) + (compose identity) + (extend home-emacs-extensions) + (description + "Configure the GNU Emacs extensible text editor."))) + +(define scheme-value->emacs-value + (match-lambda (#t (quote 't)) + (#f (quote 'nil)) + (val val))) + +(define (emacs-variables var-alist) + "Converts an alist of variable names and values into a @code{setq} +expression that can be used in an Emacs configuration. Scheme values +@code{#t} and @code{#f} will be converted into @code{t} and @code{nil}, +respectively." + #~(string-append + "(setq" + #$@(map (lambda (var) + #~(format #f "\n ~a ~s" + (quote #$(car var)) + #$(scheme-value->emacs-value (cdr var)))) + var-alist) + ")\n\n")) diff --git a/gnu/local.mk b/gnu/local.mk index 184f43e753..35d88b4dd6 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -89,6 +89,7 @@ GNU_SYSTEM_MODULES =3D \ %D%/home/services.scm \ %D%/home/services/desktop.scm \ %D%/home/services/symlink-manager.scm \ + %D%/home/services/emacs.scm \ %D%/home/services/fontutils.scm \ %D%/home/services/guix.scm \ %D%/home/services/pm.scm \ -- 2.38.1 From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 12 12:24:52 2023 Received: (at 60753) by debbugs.gnu.org; 12 Jan 2023 17:24:52 +0000 Received: from localhost ([127.0.0.1]:48492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pG1Js-0002Dt-6D for submit@debbugs.gnu.org; Thu, 12 Jan 2023 12:24:52 -0500 Received: from knopi.disroot.org ([178.21.23.139]:58914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pG1Jq-0002Dk-D1 for 60753@debbugs.gnu.org; Thu, 12 Jan 2023 12:24:51 -0500 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 905A940F10; Thu, 12 Jan 2023 18:24:48 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zgAxcBxuOyTA; Thu, 12 Jan 2023 18:24:47 +0100 (CET) Content-Type: multipart/signed; boundary=e5d54c7c5a66bc2ff4c6b5882ac9219a913b615f72f363da9bfde32cf4ff; micalg=pgp-sha512; protocol="application/pgp-signature" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1673544287; bh=bs7LB7A4OzJE81ljczvbkLlaSzXvi+GpK2yeHjK78jI=; h=Date:Subject:From:To:References:In-Reply-To; b=IpvCnqQ5c4ScElPtpURiWwaYbsU8i0b7q0n8kLNMEUEnEQppj6Oco+5H8TeoWjlWY sGQDuk7oRSMTIA4n6I78LOCpxRjjALHeRO3bJak9t951MOWm59Z4nDBtIKFW+/Kjo1 dauIBXtiVgFZDlGI+reaEXbRvUt3prRAkM2gb+oToW30fa/tf2lCZaTs2b6ovGZ15c T8YBtd+8OiYmwsC7+I983gDuUe8VZTOvy/6CDOuIfcpp4uJK34B7RnfKXeXWgJq57f PJNpE96FHbG00mlb2eC7c+JGc1TKnevlYKLDQAyNA+rBBbKC0Juhbig2XjnqCzJS1e ym3k1bKEGzVfQ== Date: Thu, 12 Jan 2023 17:24:43 +0000 Message-Id: Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. From: "(" To: "David Wilson" , <60753@debbugs.gnu.org> References: <87edrzzw9w.fsf@daviwil.com> In-Reply-To: <87edrzzw9w.fsf@daviwil.com> X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 60753 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.9 (/) --e5d54c7c5a66bc2ff4c6b5882ac9219a913b615f72f363da9bfde32cf4ff Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Thu Jan 12, 2023 at 2:01 PM GMT, David Wilson wrote: > + (service-extension > + home-shepherd-service-type > + home-emacs-shepherd-services) home-emacs-shepherd-services isn't defined here :( Doesn't this cause an u= nbound-variable error? (Also, most of the reason I wrote this service was to support auto-= starting emacs --daemon :)) -- ( --e5d54c7c5a66bc2ff4c6b5882ac9219a913b615f72f363da9bfde32cf4ff Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEE6Vh10NblKE5doNlW7ImHg/nqI20FAmPAQlsACgkQ7ImHg/nq I23juwwAwQqaBOQpEv2kdxPodyPHIUkIdq6O26kvBMwqArXrhbBlLz/oywf6hFUU 4HKrefIRNepZAFJBPcSIWAP4yywdQ7lvzCgOBoHj2bhQ+Ollvna4CsrbAbnoehf2 uhEDI/gsxomHbdLs9GeIf7qx+Z4JWYzma296GTq7deimk0xcfyCf8O69WsnLSFry mMyBCimuJ4JlmRgmy9ekbwdSoDqx/vqL2oCwUHUOR6GY48wB3BsSd/4lRMZvLBY2 aUr0Pa1zh3yAC+thi3OCEX9FRMGU6TOldPA9xDVMcmamJuYNjZ3Z7X8Eb3WKrLYX H2+G9JXQ/Rqk3bHajZvpjOyFcDRNm4jrx0h7214dju89ZGq7RB6EcUMAAsUIwCX+ bmibAd5Px+Ecyf6tlfyJbZY34UTazvVnpaBD0f/xs/jmtEcg+dAM4aioexl3p99I pC+mTFE192xB3abXPgCqM0qIomm7EdWz69+vjqGgfejl6oq+HqfreHZBhYWI5eCT CyIYbEz5 =E5Ys -----END PGP SIGNATURE----- --e5d54c7c5a66bc2ff4c6b5882ac9219a913b615f72f363da9bfde32cf4ff-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 12 12:41:44 2023 Received: (at 60753) by debbugs.gnu.org; 12 Jan 2023 17:41:44 +0000 Received: from localhost ([127.0.0.1]:48513 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pG1aB-0002dP-NT for submit@debbugs.gnu.org; Thu, 12 Jan 2023 12:41:44 -0500 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:36523) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pG1a8-0002dA-QA for 60753@debbugs.gnu.org; Thu, 12 Jan 2023 12:41:42 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 7D5E43200921; Thu, 12 Jan 2023 12:41:33 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 12 Jan 2023 12:41:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daviwil.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1673545293; x= 1673631693; bh=maBoLn/A0riPhPFOMtuBS4MzdgYoUChc43sxx2G8g/I=; b=M Wa9xwBm/lPNKxnY0z3uWeQ+mDIGmqe2wb4s/7eXnzw1FEE1ewfhpcQ1W2nKjC0aP yAWzBJiYxXqqlr/T6JNjw9k+dT0TgtTG0fpo3sJVHOEaQaY860auxQYPcpDZV4Q5 /zmJmhIzGIUWFGMwJsHHn7EWg+RoQEnltrt5utVlqBFf0ZaVQwKm2PzEHsw4xn3A xamE2573CbLk6ywTxUFlvuQ5YcbPEK2uiGLvJIKwtSKBpHLOVZrxtSZB1jXmAtlh YoI4wdvyjThXfXX8B4ZIWSpjR1k7FqGKq/kfOkT/gjCUAHqsHdKiqgGmqMj0qLOq wOKgPl3An4vTy0LJ+CqFQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1673545293; x= 1673631693; bh=maBoLn/A0riPhPFOMtuBS4MzdgYoUChc43sxx2G8g/I=; b=s iskkSD8QS6qAw5/n9fsIqMWoOujyrGDOtUCQu/6tV4G7f96HuS6rqVb4/AcJEY5D USXggc02hewrx16bYeCibglQf04oR8I+G6jJun8f9oHAe3wQ7Im2mBGKwWTDRdjW K/6WuIdLBiANmPe/ko2mL5Pn76jzJ2pHTaGg1ogFf1b1jOp9fjK0v1r5p6jTbAoe JTkGuCfG+N+zAdo1wRn1brmNVVosMn7ymXeKC1LB7mFAfKl8sq5PaZhW7lyTN5ua Crr5s2V5lU+WeRO6YNJOmz+YDQBudz8AMVZsx6HQ9GpkY9DETC1o8DNsVQydN2ii LhRH6bJv+SknrXVjvKcgQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrleeigddutdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpehffgfhvfevufffjgfkgggtgfesth hqredttderjeenucfhrhhomhepffgrvhhiugcuhghilhhsohhnuceouggrvhhiugesuggr vhhifihilhdrtghomheqnecuggftrfgrthhtvghrnhepteeigeeutdeigfekudevgfegie fgfeduveefffehfeehvdfhtedtfeevfeefudeknecuffhomhgrihhnpehgnhhurdhorhhg necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepuggrvh hiugesuggrvhhifihilhdrtghomh X-ME-Proxy: Feedback-ID: iba684179:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 12 Jan 2023 12:41:32 -0500 (EST) References: <87edrzzw9w.fsf@daviwil.com> User-agent: mu4e 1.8.11; emacs 28.2 From: David Wilson To: "(" Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. Date: Thu, 12 Jan 2023 19:27:02 +0200 In-reply-to: Message-ID: <87v8lby7jq.fsf@daviwil.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60753 Cc: 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hey (! "(" writes: > home-emacs-shepherd-services isn't defined here :( Doesn't this cause an= unbound-variable > error? (Also, most of the reason I wrote this service was to support aut= o-starting emacs > --daemon :)) Whoops, in my haste to send out the patch I forgot to take that out! Yes, I saw that you meant to run Emacs as a daemon and I think it should be added to this service (or another daemon-specific service) in a future patch. I figured it would be easier to get a patch accepted without the daemon functionality just yet since there seemed to be more feedback about that aspect in your patch thread. Here's an update to my patch that actually works (sorry if I'm doing this wrong, it's been a while since I worked on a patch thread!) -- Co-authored-by: ( --- doc/guix.texi | 77 +++++++++++++++ gnu/home/services/emacs.scm | 185 ++++++++++++++++++++++++++++++++++++ gnu/local.mk | 1 + 3 files changed, 263 insertions(+) create mode 100644 gnu/home/services/emacs.scm diff --git a/doc/guix.texi b/doc/guix.texi index 751d0957d8..62fefde1ea 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -111,6 +111,7 @@ Copyright @copyright{} 2022 (@* Copyright @copyright{} 2022 John Kehayias@* Copyright @copyright{} 2022 Ivan Vilata-i-Balaguer@* Copyright @copyright{} 2023 Giacomo Leidi@* +Copyright @copyright{} 2023 David Wilson@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -41061,6 +41062,7 @@ services)}. * Shepherd: Shepherd Home Service. Managing User's Dae= mons. * SSH: Secure Shell. Setting up the secu= re shell client. * Desktop: Desktop Home Services. Services for graphi= cal environments. +* Emacs: Emacs Home Services. Services for config= uring Emacs. * Guix: Guix Home Services. Services for Guix. @end menu @c In addition to that Home Services can provide @@ -41914,6 +41916,81 @@ The package providing the @code{/bin/dbus-daemon} = command. @end table @end deftp +@node Emacs Home Services +@subsection Emacs Home Services + +@defvr {Scheme Variable} home-emacs-service-type +This is the service type for configuring the Emacs text editor. It +enables you to assemble @file{init.el} and @file{early-init.el} files +from snippets in your home configuration and other Emacs Lisp files you +have in your personal configuration folder. + +This service can be extended using the @code{home-emacs-extension} type. + +Note that if you have an existing @file{~/.emacs} and/or +@file{~/.emacs.d}, the configuration aspect of this service will not be +loaded, as the former location takes precedence over +@file{~/.config/emacs}. This service uses the latter path in the +interest of cleanliness. To migrate to the XDG directory, run these +commands: + +@example +$ cp ~/.emacs.d $XDG_CONFIG_HOME/emacs +$ cp ~/.emacs $XDG_CONFIG_HOME/emacs/init.el +@end example +@end defvr + +@deftp {Data Type} home-emacs-configuration +The configuration record for @code{home-emacs-service-type}. + +@table @asis +@item @code{emacs} (default: @code{emacs}) +The package providing the @file{/bin/emacs} command. + +@item @code{packages} (default: @code{'()}) +Additional packages required by the Emacs configuration. + +@item @code{user-emacs-directory} (default: @file{~/.cache/emacs}) +The directory beneath which additional per-user Emacs-specific files are p= laced. + +@item @code{init-file} (default: @code{'()}) +Configuration text or files to include in @file{init.el}. + +@item @code{early-init-file} (default: @code{'()}) +Configuration text or files to include in @file{early-init.el}. + +@item @code{load-paths} (default: @code{'()}) +Additional load paths to add to Emacs' @code{load-path} variable. Lines +will be inserted at the beginning of @file{early-init.el}. + +@item @code{native-compile?} (default: @code{#f}) +Whether to compile all @code{packages}, using the provided @code{emacs} +package in place of @code{emacs-minimal}, which will enable native +compilation if the @code{emacs} package supports it. All +non-@code{-minimal} Emacs packages at version 28 or above should support +native compilation. +@end table +@end deftp + +@deftp {Data Type} home-emacs-extension +The extension record for @code{home-emacs-service-type}. + +@table @asis +@item @code{packages} (default: @code{'()}) +Additional packages required by the Emacs configuration. + +@item @code{init-file} (default: @code{'()}) +Configuration text or files to include in @file{init.el}. + +@item @code{early-init-file} (default: @code{'()}) +Configuration text or files to include in @file{early-init.el}. + +@item @code{load-paths} (default: @code{'()}) +Additional load paths to add to Emacs' @code{load-path} variable. Lines +will be inserted at the beginning of @file{early-init.el}. +@end table +@end deftp + @node Guix Home Services @subsection Guix Home Services diff --git a/gnu/home/services/emacs.scm b/gnu/home/services/emacs.scm new file mode 100644 index 0000000000..7a821fed8a --- /dev/null +++ b/gnu/home/services/emacs.scm @@ -0,0 +1,185 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2022 ( +;;; Copyright =C2=A9 2023 David Wilson +;;; +;;; 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 . + +(define-module (gnu home services emacs) + #:use-module (gnu home services) + #:autoload (gnu packages emacs) (emacs-minimal + emacs) + #:use-module (gnu services configuration) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix records) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + + #:export (emacs-variables + home-emacs-configuration + home-emacs-extension + home-emacs-service-type)) + +(define list-of-file-likes? + (list-of file-like?)) + +(define (string-or-file-like? val) + (or (string? val) + (file-like? val))) + +(define list-of-string-or-file-likes? + (list-of string-or-file-like?)) + +(define-configuration/no-serialization home-emacs-configuration + (emacs + (file-like emacs) + "The package providing the @file{/bin/emacs} command.") + (packages + (list-of-file-likes '()) + "Additional packages required by the Emacs configuration.") + (user-emacs-directory + (string "~/.cache/emacs") + "Directory beneath which additional per-user Emacs-specific files are p= laced.") + (init-file + (text-config '()) + "Configuration text or files to include in init.el.") + (early-init-file + (text-config '()) + "Configuration text or files to include in early-init.el.") + (load-paths + (list-of-string-or-file-likes '()) + "Additional load paths to add to Emacs' @code{load-path} variable. Lin= es +will be inserted at the beginning of early-init.el.") + (native-compile? + (boolean #f) + "Whether to compile the @code{packages} using the Emacs package +provided as the value of the @code{emacs} field, which will enable +native compilation if the @code{emacs} package supports it.")) + +(define (home-emacs-profile-packages config) + (cons (home-emacs-configuration-emacs config) + (home-emacs-configuration-packages config))) + +(define (home-emacs-transformed-packages config) + (map (if (home-emacs-configuration-native-compile? config) + (package-input-rewriting + `((,emacs-minimal + . ,(home-emacs-configuration-emacs config)))) + identity) + (let ((packages (home-emacs-configuration-packages config))) + (concatenate + (cons packages + (map (compose (cute map second <>) + package-transitive-propagated-inputs) + packages)))))) + +(define (serialize-emacs-load-paths config) + #~(string-append + ";; Additional load paths\n" + #$@(map (lambda (load-path) + #~(format #f "(add-to-list 'load-path \"~a\")" #$load-path)) + (home-emacs-configuration-load-paths config)) + "\n\n")) + +(define (serialize-emacs-user-directory config) + (format #f + ";; Set the `user-emacs-directory` to a writeable path\n(setq us= er-emacs-directory \"~a\")\n\n" + (home-emacs-configuration-user-emacs-directory config))) + +(define (home-emacs-xdg-configuration-files config) + `(("emacs/early-init.el" + ,(apply mixed-text-file + (cons* "early-init.el" + (serialize-emacs-load-paths config) + (serialize-emacs-user-directory config) + (home-emacs-configuration-early-init-file config)))) + ("emacs/init.el" + ,(apply mixed-text-file + (cons "init.el" + (home-emacs-configuration-init-file config)))))) + +(define-configuration/no-serialization home-emacs-extension + (packages + (list-of-file-likes '()) + "Additional packages required by the Emacs configuration.") + (init-file + (text-config '()) + "Configuration text or files to include in init.el.") + (early-init-file + (text-config '()) + "Configuration text or files to include in early-init.el.") + (load-paths + (list-of-string-or-file-likes '()) + "Additional load paths to add to Emacs' @code{load-path} variable. Lin= es +will be inserted at the beginning of early-init.el.")) + +(define (home-emacs-extensions original-config extension-configs) + (match-record original-config + (packages load-paths init-file early-init-file) + (home-emacs-configuration + (inherit original-config) + (packages + (append packages + (append-map + home-emacs-extension-packages extension-configs))) + (init-file + (append init-file + (append-map + home-emacs-extension-init-file extension-configs))) + (early-init-file + (append early-init-file + (append-map + home-emacs-extension-early-init-file extension-configs))) + (load-paths + (append load-paths + (append-map + home-emacs-extension-load-paths extension-configs)))))) + +(define home-emacs-service-type + (service-type + (name 'home-emacs) + (extensions + (list (service-extension + home-profile-service-type + home-emacs-profile-packages) + (service-extension + home-xdg-configuration-files-service-type + home-emacs-xdg-configuration-files))) + (default-value (home-emacs-configuration)) + (compose identity) + (extend home-emacs-extensions) + (description + "Configure the GNU Emacs extensible text editor."))) + +(define scheme-value->emacs-value + (match-lambda (#t (quote 't)) + (#f (quote 'nil)) + (val val))) + +(define (emacs-variables var-alist) + "Converts an alist of variable names and values into a @code{setq} +expression that can be used in an Emacs configuration. Scheme values +@code{#t} and @code{#f} will be converted into @code{t} and @code{nil}, +respectively." + #~(string-append + "(setq" + #$@(map (lambda (var) + #~(format #f "\n ~a ~s" + (quote #$(car var)) + #$(scheme-value->emacs-value (cdr var)))) + var-alist) + ")\n\n")) diff --git a/gnu/local.mk b/gnu/local.mk index 184f43e753..35d88b4dd6 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -89,6 +89,7 @@ GNU_SYSTEM_MODULES =3D \ %D%/home/services.scm \ %D%/home/services/desktop.scm \ %D%/home/services/symlink-manager.scm \ + %D%/home/services/emacs.scm \ %D%/home/services/fontutils.scm \ %D%/home/services/guix.scm \ %D%/home/services/pm.scm \ -- 2.38.1 From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 13:01:10 2023 Received: (at 60753) by debbugs.gnu.org; 14 Jan 2023 18:01:11 +0000 Received: from localhost ([127.0.0.1]:55504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGkq6-0004lo-F0 for submit@debbugs.gnu.org; Sat, 14 Jan 2023 13:01:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58118) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGkq1-0004l8-AQ for 60753@debbugs.gnu.org; Sat, 14 Jan 2023 13:01:08 -0500 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 1pGkpv-0006RS-TQ; Sat, 14 Jan 2023 13:00:59 -0500 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=YDAk3TmUww5xj0WRbb4j9aovuy0pAgOI+QWGb3Fkn/M=; b=YquLaCZaJwDM93TaEJFB QJxHdZCkjNmZVZh19eGLKnbZMQmVdJmUetvdfe1Tzh8DLN3lRUXOGAOkxchyxeXtRGIDRofVFUQfx rOmUiUdIUdgxmEG75tDk8j3IVzBp2+l567SbmYbzjfFT1nyp+IOvcqGyuwD0sb/h7jGmqE6ffSos5 bfNP9UWqA8TC9cqxXEcUFmk7j7aycWzJtc6v6JP8w4LMcVglxVr1TRpgurUV8HMeCxxE414joAtEl AK3NU380tkl0p0k3XLQJddIAUCFOTb04MG+3d8EHEfDVzDvY6CpWMhFTcW3jW+0EOS2J8VLxkd/90 uy+EZ1+6iTzXAg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pGkpv-0003jk-GK; Sat, 14 Jan 2023 13:00:59 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: David Wilson Subject: Re: bug#60753: [PATCH] gnu: home: Add home-emacs-service-type. References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> Date: Sat, 14 Jan 2023 19:00:57 +0100 In-Reply-To: <87v8lby7jq.fsf@daviwil.com> (David Wilson's message of "Thu, 12 Jan 2023 19:27:02 +0200") Message-ID: <87k01p8086.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-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60753 Cc: "\(" , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hello! David Wilson skribis: > Yes, I saw that you meant to run Emacs as a daemon and I think it should > be added to this service (or another daemon-specific service) in a > future patch. I figured it would be easier to get a patch accepted > without the daemon functionality just yet since there seemed to be more > feedback about that aspect in your patch thread. Agree, I think we should add the daemon functionality in a subsequent patch. Overall it looks nice to me! Some comments and suggestions: > +@node Emacs Home Services > +@subsection Emacs Home Services > + > +@defvr {Scheme Variable} home-emacs-service-type It would be nice if you could start the section with a few sentences explaining the rationale and what=E2=80=99s being described here. > +This is the service type for configuring the Emacs text editor. It > +enables you to assemble @file{init.el} and @file{early-init.el} files > +from snippets in your home configuration and other Emacs Lisp files you > +have in your personal configuration folder. Maybe like so: =E2=80=A6 to assemble the @file{init.el} (@pxref{Init File,,, emacs, GNU = Emacs Manual}) and @file{early-init.el} (@pxref{Early Init File,,, emacs, GNU Emacs Manual}) files =E2=80=A6 > +@example > +$ cp ~/.emacs.d $XDG_CONFIG_HOME/emacs > +$ cp ~/.emacs $XDG_CONFIG_HOME/emacs/init.el > +@end example I=E2=80=99d drop the prompt. > +@item @code{init-file} (default: @code{'()}) > +Configuration text or files to include in @file{init.el}. > + > +@item @code{early-init-file} (default: @code{'()}) > +Configuration text or files to include in @file{early-init.el}. What about accepting sexps (or gexps) instead of strings? As in: (init-file '((require 'whatever) (setq something t))) Also I find it confusing that it=E2=80=99s either text or files. In the co= de it has type =E2=80=98text-config=E2=80=99, which means list of file-like objec= ts IIUC, no? > +@item @code{load-paths} (default: @code{'()}) > +Additional load paths to add to Emacs' @code{load-path} variable. Lines > +will be inserted at the beginning of @file{early-init.el}. Nitpick: I think this should be =E2=80=98load-path=E2=80=99 (singular), bec= ause it=E2=80=99s one search path (i.e., a list of directories). And: s/Additional load paths/Additional directories/ > +@end table > +@end deftp Would be nice to have a couple of commented examples here, like you had in the first message in this thread. :-) > +@deftp {Data Type} home-emacs-extension > +The extension record for @code{home-emacs-service-type}. Would be nice to have a sentence above, like =E2=80=9CThis service type can= be extended with @code{home-emacs-extension} records, described below:=E2=80= =9D. > +@table @asis > +@item @code{packages} (default: @code{'()}) > +Additional packages required by the Emacs configuration. > + > +@item @code{init-file} (default: @code{'()}) > +Configuration text or files to include in @file{init.el}. > + > +@item @code{early-init-file} (default: @code{'()}) > +Configuration text or files to include in @file{early-init.el}. > + > +@item @code{load-paths} (default: @code{'()}) Ditto. > +@end deftp Would be great to have an example of that too. :-) Thank you! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 19:21:39 2023 Received: (at 60753) by debbugs.gnu.org; 15 Jan 2023 00:21:39 +0000 Received: from localhost ([127.0.0.1]:55784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGqmJ-00065u-63 for submit@debbugs.gnu.org; Sat, 14 Jan 2023 19:21:39 -0500 Received: from mail-108-mta165.mxroute.com ([136.175.108.165]:43531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGqmD-00065b-J4 for 60753@debbugs.gnu.org; Sat, 14 Jan 2023 19:21:37 -0500 Received: from mail-111-mta2.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta165.mxroute.com (ZoneMTA) with ESMTPSA id 185b2cd6b34000011e.001 for <60753@debbugs.gnu.org> (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Sun, 15 Jan 2023 00:21:24 +0000 X-Zone-Loop: e6a929c4231ccd0ebd300420831ad633a8e9cf5487a0 X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=benoitj.ca; s=x; h=Content-Transfer-Encoding:Content-Type:Message-ID:Subject:To:From:Date :MIME-Version:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=dBO4tcnGAkm5SfOCym/CDaYQWCkxYOC25kay4AXMGtI=; b=H 0SL5h9+ZkJIBZnyF0IbKydSolEnJmHp4AhhIkPcnkfcv8iL1IoPniJS15jsMIxdkOB2pJlETMGbzU HxmlkQ6D0Q+YP4EUrVVpzHk4YeySab8iTfzREJL+abSkYiL5rHjv6c6sSXDUHWd2Ld/IrN5P/E2zQ kMaocQaCae3qj3PLdZBRbMnZlncZW/Tvh8RpzQ64Kwp3dxXk65IuLbwX9VniMzoFwnd2ik5YMO6Co SxoSBPVYgKdm4mwh87RMxxeU4yFTMN5pQxSqBG7WpUNUbcroud+F33Sxby79zKwIU1uosMS3qms7b xpEAO+CpYwLRn4ikNWoTBqmDDjM2Sow5A==; MIME-Version: 1.0 Date: Sat, 14 Jan 2023 19:21:23 -0500 From: benoit@benoitj.ca To: 60753@debbugs.gnu.org Subject: file like parameters not working Message-ID: X-Sender: benoit@benoitj.ca Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Id: benoit@benoitj.ca X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60753 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, the last patch fixed the undefined issue, now the configuration does not work with file-like input. this example: (init-file (list (local-file "init.el"))) the resulting ~/.config/emacs/init.el has the path of my init.el file instead of it's content. I'm suspecting the serialization code consider init-file list to always be string. If I put a string instead of a local-file, I get the proper behavior. thanks for doing this! I'll see if I can troubleshoot the issue later tonight. Benoit From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 14 21:07:44 2023 Received: (at 60753) by debbugs.gnu.org; 15 Jan 2023 02:07:44 +0000 Received: from localhost ([127.0.0.1]:55863 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGsQy-0000NY-0r for submit@debbugs.gnu.org; Sat, 14 Jan 2023 21:07:44 -0500 Received: from mail-108-mta195.mxroute.com ([136.175.108.195]:35231) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGsQu-0000NI-Qz for 60753@debbugs.gnu.org; Sat, 14 Jan 2023 21:07:42 -0500 Received: from mail-111-mta2.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta195.mxroute.com (ZoneMTA) with ESMTPSA id 185b32e9bfe000011e.001 for <60753@debbugs.gnu.org> (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Sun, 15 Jan 2023 02:07:34 +0000 X-Zone-Loop: 6b085d7249e7cab9e115bf185893d8ebaf44e2e91942 X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=benoitj.ca; s=x; h=Content-Transfer-Encoding:Content-Type:Message-ID:Subject:To:From:Date :MIME-Version:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=zsX4xJJz+jwDnFc++M9g58KOmN94BV/nbYXCtpqV7c4=; b=S htoIA0eWK3v/AQvSf4LFZppOpjieja7Wkybyjp7TGHg5Mvpvw/aGLGc5K1tdQ3PV8Z8JGpt4EhRak W5Adj2hKtCE2v4J4fCJj69RtZ3prWuVfTSecXCv/t1O55IoCwCgYDu1o816T2Hkk6+q/94fj1N19P CTAy1oCDGMsRonvdyV24/P6xQzc+exmqs00w5QxYTfVnDQXMMYYpIP2SWr5JKsvxJwgzeWnMkkJML Txd5LjEeGpKIDSHtCG9WIQQIZ62MQ+pozDrORpn2ahDIK1up0jObNJr88YvoWBeTH4rw7ESBx1xyq buEtg9vXB/Qs/egCBIb2BdKsaPR3JSxpw==; MIME-Version: 1.0 Date: Sat, 14 Jan 2023 21:07:32 -0500 From: benoit@benoitj.ca To: 60753@debbugs.gnu.org Subject: issue with file-like init file Message-ID: X-Sender: benoit@benoitj.ca Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Id: benoit@benoitj.ca X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60753 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi David, I think I found the issue. It looks like the mixed-text-file function does not replace file-like object with their content, but instead with their path. if you look at the example in the documentation: https://guix.gnu.org/manual/en/html_node/G_002dExpressions.html you'll see that it's being used to replace the file-like with it's path in an "export" clause. So it totally explain what I see in my generated init file. When compared with home-bash-service-type in shells.scm, it calls "serialize-configuration" on the file-like object. This is found in add-bash-configuration. Hope this helps. thanks! Benoit From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 15 03:02:18 2023 Received: (at 60753) by debbugs.gnu.org; 15 Jan 2023 08:02:18 +0000 Received: from localhost ([127.0.0.1]:56068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGxy6-0001XS-E6 for submit@debbugs.gnu.org; Sun, 15 Jan 2023 03:02:18 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:53071) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pGxy3-0001XD-9C for 60753@debbugs.gnu.org; Sun, 15 Jan 2023 03:02:16 -0500 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id 4B92860002; Sun, 15 Jan 2023 08:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1673769729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4Ac7eYO7Ztg7VhOjIZD6EtvOslyjIQGjD0GcKsY5bi4=; b=WxH4FSW0XrtXCrG3IsPSvMJTZHRUUHZuaXC/3S6WFZ5LnHd5JYaN3UNy9R5JynTsggTjRK 7mycGnjyzB9rUqb4dJerLfGPSkR+D6lsDfF+ujRNd9DZV8uyDs2gFxODhawYiXDKOZp09Q D4VUnEHabHwjf0T34M2Ae6hyHPRPXd7J4kD3wNYjrwaRUVXRq5KA0yg0ybb4qttIP3OFrF n5I1LGmio4bPEkuLhJMWGptTgLk4xkX4LFH2Yj8qOqEupIkQQCE298PQDY3/jKTWHEwR+7 p5u8zeXsceKhgi1LElC2s/ALgBnlmZHhrf7DKeqlz0Jh1ns0m49ZLjHfVbTShA== From: Andrew Tropin To: Ludovic =?utf-8?Q?Court=C3=A8s?= , David Wilson Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. In-Reply-To: <87k01p8086.fsf_-_@gnu.org> References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> Date: Sun, 15 Jan 2023 12:02:04 +0400 Message-ID: <87cz7g2pkz.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60753 Cc: "\(" , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2023-01-14 19:00, Ludovic Court=C3=A8s wrote: > Hello! > > David Wilson skribis: > >> Yes, I saw that you meant to run Emacs as a daemon and I think it should >> be added to this service (or another daemon-specific service) in a >> future patch. I figured it would be easier to get a patch accepted >> without the daemon functionality just yet since there seemed to be more >> feedback about that aspect in your patch thread. > > Agree, I think we should add the daemon functionality in a subsequent > patch. > > Overall it looks nice to me! Some comments and suggestions: > >> +@node Emacs Home Services >> +@subsection Emacs Home Services >> + >> +@defvr {Scheme Variable} home-emacs-service-type > > It would be nice if you could start the section with a few sentences > explaining the rationale and what=E2=80=99s being described here. > >> +This is the service type for configuring the Emacs text editor. It >> +enables you to assemble @file{init.el} and @file{early-init.el} files >> +from snippets in your home configuration and other Emacs Lisp files you >> +have in your personal configuration folder. > > Maybe like so: > > =E2=80=A6 to assemble the @file{init.el} (@pxref{Init File,,, emacs, GN= U Emacs > Manual}) and @file{early-init.el} (@pxref{Early Init File,,, emacs, > GNU Emacs Manual}) files =E2=80=A6 > >> +@example >> +$ cp ~/.emacs.d $XDG_CONFIG_HOME/emacs >> +$ cp ~/.emacs $XDG_CONFIG_HOME/emacs/init.el >> +@end example > > I=E2=80=99d drop the prompt. > >> +@item @code{init-file} (default: @code{'()}) >> +Configuration text or files to include in @file{init.el}. >> + >> +@item @code{early-init-file} (default: @code{'()}) >> +Configuration text or files to include in @file{early-init.el}. > > What about accepting sexps (or gexps) instead of strings? As in: > > (init-file '((require 'whatever) (setq something t))) A quick minor note on this approach: it won't be possible to use #'elisp-function inside such configuration because it will be interpreted by guile reader, but actually rde lives without this functionality completely ok. Do we want something like this possible? (init-file `((require 'whatever) (setq something t) (load ,(local-file "old-init.el"))) > > Also I find it confusing that it=E2=80=99s either text or files. In the = code it > has type =E2=80=98text-config=E2=80=99, which means list of file-like obj= ects IIUC, no? > >> +@item @code{load-paths} (default: @code{'()}) >> +Additional load paths to add to Emacs' @code{load-path} variable. Lines >> +will be inserted at the beginning of @file{early-init.el}. > > Nitpick: I think this should be =E2=80=98load-path=E2=80=99 (singular), b= ecause it=E2=80=99s one > search path (i.e., a list of directories). > > And: s/Additional load paths/Additional directories/ > >> +@end table >> +@end deftp > > Would be nice to have a couple of commented examples here, like you had > in the first message in this thread. :-) > >> +@deftp {Data Type} home-emacs-extension >> +The extension record for @code{home-emacs-service-type}. > > Would be nice to have a sentence above, like =E2=80=9CThis service type c= an be > extended with @code{home-emacs-extension} records, described below:=E2=80= =9D. > >> +@table @asis >> +@item @code{packages} (default: @code{'()}) >> +Additional packages required by the Emacs configuration. >> + >> +@item @code{init-file} (default: @code{'()}) >> +Configuration text or files to include in @file{init.el}. >> + >> +@item @code{early-init-file} (default: @code{'()}) >> +Configuration text or files to include in @file{early-init.el}. >> + >> +@item @code{load-paths} (default: @code{'()}) > > Ditto. > >> +@end deftp > > Would be great to have an example of that too. :-) > > Thank you! > > Ludo=E2=80=99. > > > =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmPDsv0ACgkQIgjSCVjB 3rBSBA/8DXu4n7CvHgxDSaG01Yd8oZbT1I5AJdA1XPV8uXgha1t/47uTw00jNvmH Rf0Eexc7ulasQ0VSQcqS6KwoJWSAukdUOqDuPL/zb96+Yrdd2g2tt/II38BFbzuC 1DR5f2VwpHXnP1bRLseiSn1U4o3WQfUq0B3HGa2x7gbAPY1ve85eeb6w8fYjCL8M KoHNOrDTt4lmTUmgMAdqnzkBqvkOlHZV+SEKR5zKKqgSt9gENc4aSHf3zTT3TVGO jQagFvifZlSVAJD63huonNy/QXMMdwk4LXVfmNHzvvfCignMY5UN70hrNbYo/duR SwQlwUJF6s9v5tJT7vT4Nc1LbnS3iablDt6kcTCocovNI/J84qqZyjY5p+iebMjD vvF4X9vv1Bu7zlqEKVfQky1IS0CBCN6XyLfRqOwDKo0+sj8ldbvfWgQFmANNHkbO edB1wIapUjR784foOhGuSnPbJIf91s1JtNShoFN9CCBeT8qaT4dehZTvaY0hGc10 5ENJ+X8x50GfqxW2JbCDHc98CGmtNt5lgf0bS88dVFb5Ao0CH40NXYGAtoktRicl O4POJLC5ugxS5TzBXTXZ3QbpM/rPETgEf3B/YzcD3nEQGIkdGzx6asNu5ZfKIVuB +ZS+4kJNFaGcooJbWekB/gAE2d9VotYL5pjx+ujlv4mK1yDXOko= =+wbi -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 16 05:12:49 2023 Received: (at 60753) by debbugs.gnu.org; 16 Jan 2023 10:12:49 +0000 Received: from localhost ([127.0.0.1]:60502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHMTx-0000gY-1V for submit@debbugs.gnu.org; Mon, 16 Jan 2023 05:12:49 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:38423) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHMTu-0000gJ-38 for 60753@debbugs.gnu.org; Mon, 16 Jan 2023 05:12:47 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 09A985C00C6; Mon, 16 Jan 2023 05:12:40 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 16 Jan 2023 05:12:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daviwil.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1673863960; x= 1673950360; bh=5Ujib5uR5C+NHVzgi0Z63NvUiKancTGoVuF74dDDdxM=; b=Q mSl5kFHvcHnJdiyBUrPv7ifAg9KQhEHo9oaqI9gpJPLIWtAroUqPf8uW4utltSPt d/3iyA6Ihz3IQt0jLxMM2b+WZaVDa+1BToSRs1u2HhItI4AGeh0aYREe8gyFTjYo AW7Jl7FLt2MvegHYIx7Xt2cliIcnb+I2yo0jtLzNjXKaa6/3Z/DAq5Ul6fj+PwHa x7BlZY9qNMPwcwXynmkB3M6OUY3y0x6rqEbDf+IQpPcLydHNfWNaYskBFN5X9mej v6Pqmq2cYDVoxNd/ZiYYegXGAyjOWOf/Gvr4Agfy1UQe7uV2EitNwostms241M85 A7QOu93dFAIRuKeeyTZaA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1673863960; x= 1673950360; bh=5Ujib5uR5C+NHVzgi0Z63NvUiKancTGoVuF74dDDdxM=; b=B a09R+Sh6HhKAb3nKnVDkLe4pTK5iOf84b/YxSeh/4yRqCxU2pwWfLIg983JosnhK RXmtseoZe2d25ZrQh6p0VYyJuXT+8rotJILugDZEZKNQMWr1KmpeVOuIk40o/xGG BO52VCLjIFmYjuYmwYCvlW2eGENE8MFMM5XhDPW53YO7dZLWesLdEJ5SHcecGp2G SRyxWLyMM8+NVeGVWKMEQFZ6Ucph3ZbR1bxFVb5IDsn3iVnsgBRr58wETrKZjbUo MoK3T8NBLgPIHyzo8TTFGFTF5ERFRQ2zweRowCQh1fy2rT5hOVLN7zcVcAYbCBfG DS628noJuyNHhKRN0G5mw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddtgedguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfhgfhffvvefuffgjkfggtgfgsehtqhertddtreejnecuhfhrohhmpeffrghv ihguucghihhlshhonhcuoegurghvihgusegurghvihifihhlrdgtohhmqeenucggtffrrg htthgvrhhnpedutdfgieehhefhtdefgeevgeehgfehudegvefhudeijeehgffhudfhvedt jeegffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gurghvihgusegurghvihifihhlrdgtohhm X-ME-Proxy: Feedback-ID: iba684179:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 16 Jan 2023 05:12:38 -0500 (EST) References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> User-agent: mu4e 1.8.11; emacs 28.2 From: David Wilson To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#60753: [PATCH] gnu: home: Add home-emacs-service-type. Date: Mon, 16 Jan 2023 11:25:29 +0200 In-reply-to: <87k01p8086.fsf_-_@gnu.org> Message-ID: <87h6wqu6ss.fsf@daviwil.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60753 Cc: "\(" , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Thanks for the feedback, Ludo! I'll make the requested changes and send them later today. I may also try adding some tests to ensure that the output is what we expect. There seems to be a `tests/services` folder, should I add a `tests/home-services` folder to match? Ludovic Court=C3=A8s writes: > It would be nice if you could start the section with a few sentences > explaining the rationale and what=E2=80=99s being described here. Will do, I'll look at other services to get an idea of the best way to do this. > What about accepting sexps (or gexps) instead of strings? As in: > > (init-file '((require 'whatever) (setq something t))) > > Also I find it confusing that it=E2=80=99s either text or files. In the = code it > has type =E2=80=98text-config=E2=80=99, which means list of file-like obj= ects IIUC, no? Yes, this was a misunderstanding on my part! Regarding using s-expressions for this, it would certainly look cleaner. Andrew raises a good concern about it in his response, I'll take a look at what RDE does for this and see if I can adopt a similar approach. > Nitpick: I think this should be =E2=80=98load-path=E2=80=99 (singular), b= ecause it=E2=80=99s one > search path (i.e., a list of directories). > > And: s/Additional load paths/Additional directories/ Will change both of these, thanks! > Would be nice to have a couple of commented examples here, like you had > in the first message in this thread. :-) Yep, I'll add examples for all the use cases here. > Would be nice to have a sentence above, like =E2=80=9CThis service type c= an be > extended with @code{home-emacs-extension} records, described below:=E2=80= =9D. Will describe and give an example of how to extend the service! David From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 17 04:02:55 2023 Received: (at 60753) by debbugs.gnu.org; 17 Jan 2023 09:02:55 +0000 Received: from localhost ([127.0.0.1]:35645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHhrr-00085U-4G for submit@debbugs.gnu.org; Tue, 17 Jan 2023 04:02:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56636) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHhrp-00085I-JU for 60753@debbugs.gnu.org; Tue, 17 Jan 2023 04:02:53 -0500 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 1pHhrj-0001yB-91; Tue, 17 Jan 2023 04:02:47 -0500 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=LDc/b6n3GiL6lzs55cHyRKKdYnKOOQmmR1G+312Fx9w=; b=ChlISk2H5gIEBasuzP/d 4e3H2gMVApTeQ93BEuJ7FfA4ucdO2/DI+nyeZ0v8844DGbuixfstDOuBEFLleKdmdkrbNML0I75wl yyY7lHf9V/LlUB8/lqC5RR+CNtdo8P9kf9AF2mu07XBHhoPfwnf85YrOY4GWom5ASKUME2ivMuHWm yTCtVg0mPq/dia1t9Sonz/DYrOCpZRV7Q6xYhedGupOdcWews5Mus9GkbGWcuu5R84I33vUt81nCr zm4xcDYIoAtY3Ue+/xmNSaqjrLqG57IFnvH6ZPWUEEhXLzPlUlKsmEwFQG+VPfmf66utjyqBppzVw /eed1GAqJ7rCig==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHhrU-0005sW-2U; Tue, 17 Jan 2023 04:02:36 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andrew Tropin Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Octidi 28 =?utf-8?Q?Niv=C3=B4se?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du Zinc X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 17 Jan 2023 10:02:30 +0100 In-Reply-To: <87cz7g2pkz.fsf@trop.in> (Andrew Tropin's message of "Sun, 15 Jan 2023 12:02:04 +0400") Message-ID: <87mt6hjzyx.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-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60753 Cc: "\(" , David Wilson , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Andrew Tropin skribis: >> What about accepting sexps (or gexps) instead of strings? As in: >> >> (init-file '((require 'whatever) (setq something t))) > > A quick minor note on this approach: it won't be possible to use > #'elisp-function inside such configuration because it will be > interpreted by guile reader, but actually rde lives without this > functionality completely ok. Specifically: (write '#'x) |=3D (syntax x) But we can use (guix read-print) and ensure that it prints #'. > Do we want something like this possible? > > (init-file `((require 'whatever) > (setq something t) > (load ,(local-file "old-init.el"))) It=E2=80=99d be nice. In that case, we=E2=80=99ll want it to be a gexp tho= ugh: #~((require 'whatever) (load #$(local-file =E2=80=A6))) Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 17 09:46:46 2023 Received: (at 60753) by debbugs.gnu.org; 17 Jan 2023 14:46:46 +0000 Received: from localhost ([127.0.0.1]:36260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHnEc-0001V5-EI for submit@debbugs.gnu.org; Tue, 17 Jan 2023 09:46:46 -0500 Received: from relay11.mail.gandi.net ([217.70.178.231]:48055) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHnEZ-0001Ul-29 for 60753@debbugs.gnu.org; Tue, 17 Jan 2023 09:46:44 -0500 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id C4567100004; Tue, 17 Jan 2023 14:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1673966797; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0YubQs2aD8TLZ7Sq8FG8XiubprxdQftS9bp26eN3bIU=; b=HgeodO1TXFcgoeacFpHlclV/gehzJ9+qraSJHiEBxOGAACzEigGhPHHQ1xufB7je/osjad UwAF/141SXqt+IGZHkIh9e6X96mjBxjCO/4wV++4enDwH7f8KMGCFVnaiJYOc5vlI3SOnT o+Lu5tXt7ixZXfaEcJDU1Nwb9iyrHXMOd2tbQtxp+UFl5VGiLLm4U4z8BxW8ZDEcky+Yc3 cvrMxbXutpzhH+g4kVOQiYrVEu++nqsLBGa9Vlnxii8J2us9pbLnVCQ/Y5Lo37a4GfVJQP YHmbyo1Uuf9wBujNAr+LV2mLJtWrEXS3+/STHvu0XcPrBZQ1D9WpsTgNNjanww== From: Andrew Tropin To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. In-Reply-To: <87mt6hjzyx.fsf@gnu.org> References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> <87mt6hjzyx.fsf@gnu.org> Date: Tue, 17 Jan 2023 18:46:32 +0400 Message-ID: <87wn5l8bhz.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60753 Cc: "\(" , David Wilson , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2023-01-17 10:02, Ludovic Court=C3=A8s wrote: > Hi, > > Andrew Tropin skribis: > >>> What about accepting sexps (or gexps) instead of strings? As in: >>> >>> (init-file '((require 'whatever) (setq something t))) >> >> A quick minor note on this approach: it won't be possible to use >> #'elisp-function inside such configuration because it will be >> interpreted by guile reader, but actually rde lives without this >> functionality completely ok. > > Specifically: > > (write '#'x) > |=3D (syntax x) > > But we can use (guix read-print) and ensure that it prints #'. > Do you have any links to docs/sample implementations on the topic of extending guile reader, so we have an example to start with? Does guix workflow language do something like that? I think it will be cool to hook up a custom reader, ideally comment preserving, for emacs lisp inside scheme files. >> Do we want something like this possible? >> >> (init-file `((require 'whatever) >> (setq something t) >> (load ,(local-file "old-init.el"))) > > It=E2=80=99d be nice. In that case, we=E2=80=99ll want it to be a gexp t= hough: > > #~((require 'whatever) (load #$(local-file =E2=80=A6))) > gexps are nice, but do we really need/want them here? Do you have any thoughts on what are the benifits over quasiquotes in this case? Maybe some examples? =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmPGtMgACgkQIgjSCVjB 3rBqPQ/9HKOEKud2ZBdmTEr5f5kOQ59wLdRZ4wQetzJlzs+QxF5i+P2QmUChfTlo 72GpXItoshuerESkoYBaDfZ/Gu1bY/wrQ+6SoZqsJ6rAdQnPuBvfOH5PHBgR7zAD NSRdraSwsU8tmefpCuTP9p/Wz84+TgOBlVhe17XRNeShK34LDkpuDhBG5hEjW2Jt po64au/TFQttWlPhL/YZiBx04OFuSTk7KEs8wlciPHGXLizuMg7aDZvHdYC0aKO4 vRaOFjikHIeb1etpuuSH8paLO7wOsq2WNvPYzqXO0+pIeHpEtLExhJR2WpXj4wEU S/qUcwwc5VD12vUnGOWBFxFR0s0VOpTaWl4MEvXdsbpGhKGbAbYfDnOyp/mcl0y/ 8xmsLrx8zvXf4JF4zh4C35p37UjN6KkKMONyHyeNDh0H9nm2o4L1xzxtePlNLpOf XLDKBEIOLe0AgoKpJV55KjmCOYfIAbdeHJpla8skLr03ZfOqzyr0n8jf+Siu9V/k R/TVUFlyxLhqJxSDjSj+BR+EOYIU3AhCxyG/4wxv0Sfh/BgiboSUmTsH2XFiVeLU +dOwXNrBqB8d9n4jYwGHI2BqJ8+xOEilbOjqVLp3rpvuZwkpfmE35D2437hrfkAn HfwNPMlHYgwRenObR82dOZyXcGX2wu1l3aHTZ1gBMp0PjZL6XIM= =GU8y -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 23 05:19:05 2023 Received: (at 60753) by debbugs.gnu.org; 23 Jan 2023 10:19:05 +0000 Received: from localhost ([127.0.0.1]:53434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJtuq-0007Vt-LV for submit@debbugs.gnu.org; Mon, 23 Jan 2023 05:19:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJtul-0007VL-Ne for 60753@debbugs.gnu.org; Mon, 23 Jan 2023 05:19:03 -0500 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 1pJtuf-0008Cy-7z; Mon, 23 Jan 2023 05:18:53 -0500 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=5NaG2yXc50UKRR7oYU0AM7vuvIkXdbLSJl/CH5VDcdE=; b=WBpLkLgNQjKTyHS4s6+l 3TUaslFd+AKwFweCRN2DQUtQ3BjnOWsd3lIm+HRTilNRPZuFb44wBQLLDfClheGvtMw6mpr0KCQUr X8NBw1okvij2WNzbLtgzMU0WXBUOLhgZ1+Ib1AYJOLwLO98udvWxkrhum8XRQMKuwHWrUuqs6OgVC qhCPuRv3wyfYGB3bsr99TBoWnHC7SflpLzw146xa9ZtveGHKBNhGmO5gfcajc8nVwwsHRj8TY1F2c 4FekIDEqIzATVcyITTF1cBlMsxqwQNiLav/gS6K8kFxKw55iqMUQACLy+LKI20i1+exTPuG3qgLYe TU34GWb0X0bkvg==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJtuc-0001tE-Rg; Mon, 23 Jan 2023 05:18:51 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andrew Tropin Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> <87mt6hjzyx.fsf@gnu.org> <87wn5l8bhz.fsf@trop.in> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Quartidi 4 =?utf-8?Q?Pluvi=C3=B4se?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du Perce-neige X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 23 Jan 2023 11:18:47 +0100 In-Reply-To: <87wn5l8bhz.fsf@trop.in> (Andrew Tropin's message of "Tue, 17 Jan 2023 18:46:32 +0400") Message-ID: <87ilgx4kqg.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-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60753 Cc: "\(" , David Wilson , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Andrew Tropin skribis: > On 2023-01-17 10:02, Ludovic Court=C3=A8s wrote: > >> Hi, >> >> Andrew Tropin skribis: >> >>>> What about accepting sexps (or gexps) instead of strings? As in: >>>> >>>> (init-file '((require 'whatever) (setq something t))) >>> >>> A quick minor note on this approach: it won't be possible to use >>> #'elisp-function inside such configuration because it will be >>> interpreted by guile reader, but actually rde lives without this >>> functionality completely ok. >> >> Specifically: >> >> (write '#'x) >> |=3D (syntax x) >> >> But we can use (guix read-print) and ensure that it prints #'. >> > > Do you have any links to docs/sample implementations on the topic of > extending guile reader, so we have an example to start with? It=E2=80=99s not the reader but rather the writer that we=E2=80=99d want to= tweak. In (guix read-print), =E2=80=98pretty-print-with-comments=E2=80=99 already = special cases quasiquote etc. so that it prints =E2=80=98`=E2=80=99 (backtick) and not = =E2=80=98quasiquote'. We=E2=80=99d add clauses for =E2=80=98syntax=E2=80=99 and =E2=80=98quasisyn= tax=E2=80=99. > I think it will be cool to hook up a custom reader, ideally comment > preserving, for emacs lisp inside scheme files. (guix read-print) is what you want. :-) >>> Do we want something like this possible? >>> >>> (init-file `((require 'whatever) >>> (setq something t) >>> (load ,(local-file "old-init.el"))) >> >> It=E2=80=99d be nice. In that case, we=E2=80=99ll want it to be a gexp = though: >> >> #~((require 'whatever) (load #$(local-file =E2=80=A6))) >> > > gexps are nice, but do we really need/want them here? Do you have any > thoughts on what are the benifits over quasiquotes in this case? Maybe > some examples? The benefit in the example above is that the gexp would actually work whereas the sexp wouldn=E2=80=99t :-), unless there=E2=80=99s code somewher= e to manually traverse the sexp adn replace the record with its store item (which is what gexps are about). I hope that makes sense! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 26 00:06:43 2023 Received: (at 60753) by debbugs.gnu.org; 26 Jan 2023 05:06:43 +0000 Received: from localhost ([127.0.0.1]:60366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKuTC-0001EX-Jz for submit@debbugs.gnu.org; Thu, 26 Jan 2023 00:06:43 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:56863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKuT8-0001EE-16 for 60753@debbugs.gnu.org; Thu, 26 Jan 2023 00:06:40 -0500 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id 8E1331C0002; Thu, 26 Jan 2023 05:06:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1674709592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yUhI8VVgrGEyiEis21QUkoO9ZG4bJetiX+GjRsVHAZk=; b=lRLYBYndEwopUh749Sd3KlE55/53MiNYmINVEDZ+VZEgE362QtEKZ2Of7oOV+iT+XjlVsG 8MLuFkds7Rfo/h8+Sg36Iu9NbHODFXNo/ZCin8gsFaPZ91X2qVCsmKepci4z91dBYZZWnb I6VRfkL3CGrvQiFFV/fCIzTG5W/xfDhG9QsfLhSeAnTtIxE03wEnlfcZ6H//gs9twDm5dG zCkqZ+mdwkU9LoSQTSDRgEQjaMD4oCMBu5Yy2LPfnKFiTXT1PX/o5WmHMAUxFjXFoFysoF 66B3fo9Enq1EjcbRSgP7bcK4OPkgQkFRCZ3HRFv8E+r5PObAZqqQNJmdc7Vbgw== From: Andrew Tropin To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. In-Reply-To: <87ilgx4kqg.fsf@gnu.org> References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> <87mt6hjzyx.fsf@gnu.org> <87wn5l8bhz.fsf@trop.in> <87ilgx4kqg.fsf@gnu.org> Date: Thu, 26 Jan 2023 09:06:26 +0400 Message-ID: <87v8ktvq99.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60753 Cc: "\(" , David Wilson , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2023-01-23 11:18, Ludovic Court=C3=A8s wrote: > Hi, > > Andrew Tropin skribis: > >> On 2023-01-17 10:02, Ludovic Court=C3=A8s wrote: >> >>> Hi, >>> >>> Andrew Tropin skribis: >>> >>>>> What about accepting sexps (or gexps) instead of strings? As in: >>>>> >>>>> (init-file '((require 'whatever) (setq something t))) >>>> >>>> A quick minor note on this approach: it won't be possible to use >>>> #'elisp-function inside such configuration because it will be >>>> interpreted by guile reader, but actually rde lives without this >>>> functionality completely ok. >>> >>> Specifically: >>> >>> (write '#'x) >>> |=3D (syntax x) >>> >>> But we can use (guix read-print) and ensure that it prints #'. >>> >> >> Do you have any links to docs/sample implementations on the topic of >> extending guile reader, so we have an example to start with? > > It=E2=80=99s not the reader but rather the writer that we=E2=80=99d want = to tweak. Right, it already can read #'x as (syntax x) and we can print it properly later, but AFAIK comments are ignored by the default reader. So I would expect to do something (very roughly) like this: =2D-8<---------------cut here---------------start------------->8--- (parameterize (((@@ (guix gexp) read-procedure) read-with-comments)) #~(list 'hello ; Comment I would like to preserve during serialization 'guix)) =2D-8<---------------cut here---------------end--------------->8--- Of course it doesn't work, but I hope demonstrates the idea. > > In (guix read-print), =E2=80=98pretty-print-with-comments=E2=80=99 alread= y special > cases quasiquote etc. so that it prints =E2=80=98`=E2=80=99 (backtick) an= d not > =E2=80=98quasiquote'. We=E2=80=99d add clauses for =E2=80=98syntax=E2=80= =99 and =E2=80=98quasisyntax=E2=80=99. > It seems ice-9 pretty-print also preserves backticks, but I see that pretty-print-with-comments also preserves gexps, which is cool. Adding syntax will make it even cooler. >> I think it will be cool to hook up a custom reader, ideally comment >> preserving, for emacs lisp inside scheme files. > > (guix read-print) is what you want. :-) > Can you give a hint on how to use it for preserving comments, please? >>>> Do we want something like this possible? >>>> >>>> (init-file `((require 'whatever) >>>> (setq something t) >>>> (load ,(local-file "old-init.el"))) >>> >>> It=E2=80=99d be nice. In that case, we=E2=80=99ll want it to be a gexp= though: >>> >>> #~((require 'whatever) (load #$(local-file =E2=80=A6))) >>> >> >> gexps are nice, but do we really need/want them here? Do you have any >> thoughts on what are the benifits over quasiquotes in this case? Maybe >> some examples? > > The benefit in the example above is that the gexp would actually work > whereas the sexp wouldn=E2=80=99t :-), unless there=E2=80=99s code somewh= ere to manually > traverse the sexp adn replace the record with its store > item (which is what gexps are about). > > I hope that makes sense! With this simple serializer we already achieved quite good results:=20 https://git.sr.ht/~abcdw/rde/tree/388d3ad95e8607543df3dcdf26d058b610e77389/= src/rde/serializers/lisp.scm#L35 For this input =2D-8<---------------cut here---------------start------------->8--- `((load ,(local-file "./feature-lists.scm")) ,#~(format #f "hello") ; top level gexps are evaluated (list ,#~(format #f "hello")) ; nested gexps are not ,#~";; hacky comment" ;; comment, which is not preserved #'hi-fn ; incorrectly serialized, but fixable by alternative ; pretty-print ) =2D-8<---------------cut here---------------end--------------->8--- it provides quite satisfying results: =2D-8<---------------cut here---------------start------------->8--- (load "/gnu/store/xb6ma0mcgg1zzq645s63arvy3qskmbiz-feature-lists.scm") hello (list (format #f "hello")) ;; hacky comment (syntax hi-fn) =2D-8<---------------cut here---------------end--------------->8--- It's a little incosistent (top level gexp are evaluated, but nested are not), comments are not preserved and #' serialized incorrectly, but other than that it works very good. WDYT about overall approach used here? or we can do it radically better? =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmPSClIACgkQIgjSCVjB 3rCylxAAkulwhScUyGj8PhTxx9lyrUS5tA8NWDgRop8L/+gwyn8GAtYUhT3kljXz 3txf97vp/cHzAB8DkjXao0omAVlqXd8q2DPMxBjXeUVBkQuaxE4qA/3T7MTS2rVx WuBi/cI3Un8Y5m1WXOeoLxkjEgvOep7FDu887Ekzu+/JZ32DlDRFv6EP8N6ljbu4 DDlqVDlMGTzbIvRWKOloqpy/wIiaPA1ITVXQnyWhEyVSN8Yc9ajrWCSqugzFwiDS FMGOF5Vzf/WKz9shwhNu7HGS5S3h4kyCIxow5OoiiV2JQ9s6NovQd8Pt4x96rhTn tiCiFU4JO9TMEAn+Hgmx111cuuhzIQn+Acg3knoHxTbsCjTF4SsNhJskm6khJqBI mXNRCK9N2VhbXcLUwQaEeB5WCYy+954nbp93jIBL4uib6Rfz71zspWLbjNPWk+fq iI+ofk3NZAKybOYj2IuPksN0UHYZZ2pCUJE3DgA/IBvBEL8Ljkh3QI5dIEy/mQfQ d2MdG09CsVXBU9/u83+PPfxyt8ED7op2OnhH8+FjKpWfzEZW+KZS0xaDiDTVn2nx P2y3qDi1IfN7Ed9gAnf86AMHeKNKJ2SgCN4tegMaED+JqmkyehqNn5wj0b9OFi74 DU5M6X0Cyk+HzdHlfRyrCLdAjRmBw4CQ4H9OEkM7+Dbj5xHrghk= =7FZo -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 26 13:51:08 2023 Received: (at 60753) by debbugs.gnu.org; 26 Jan 2023 18:51:08 +0000 Received: from localhost ([127.0.0.1]:36185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pL7L1-0008Og-RE for submit@debbugs.gnu.org; Thu, 26 Jan 2023 13:51:08 -0500 Received: from mout-p-101.mailbox.org ([80.241.56.151]:51146) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pL7Ky-0008Nz-FN for 60753@debbugs.gnu.org; Thu, 26 Jan 2023 13:51:06 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4P2qXw1055z9sRg; Thu, 26 Jan 2023 19:50:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=reilysiegel.com; s=MBO0001; t=1674759056; h=from:from: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: in-reply-to:in-reply-to:references:references; bh=o6ED+RMscmghqY6+VXgN23JhcVsduAdfUtkiHl2PA9o=; b=bqc8s0FgMaGSXBSXZFlzd7NKqkG6np4fyQ63onHS0QxLVT2vgabUJx+ih1aEQZ38zJAI3T eke6J2MWXnD+aze0+gcaobLu72Ws7vZHGZLB+Hh0X34HesDWFUamvsQW20xN9h/w5qW+T3 sLzOvVOB1ugxJZ7srEDRu3MxEnqyH0sg70I6GFVqRIE1O+kqlhKtaZwBLLo+3xBHh1oWEl 39uOhqWpOjdUiPk7cG+aXwtKosHiH/iOoxUX7Q1jIbHGre1b2Y99pbZ0N4H2UazNjo2sH0 PlNLdH5z0x/DcBtSEH56ejKUzTqKtqtWLj+2H9zI7vxKNBMBEd/DF+ZakEJvAg== From: Reily Siegel To: Ludovic =?utf-8?Q?Court=C3=A8s?= , Andrew Tropin Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. In-Reply-To: <87mt6hjzyx.fsf@gnu.org> References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> <87mt6hjzyx.fsf@gnu.org> Date: Thu, 26 Jan 2023 13:50:45 -0500 Message-ID: <878rhpuo3e.fsf@reilysiegel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60753 Cc: "\(" , David Wilson , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Ludovic Court=C3=A8s writes: > Specifically: > > (write '#'x) > |=3D (syntax x) > > But we can use (guix read-print) and ensure that it prints #'. The way I get around this in my config is adding #+begin_source emacs-lisp ;; #' exports a scheme (syntax ...) form. Treat this as a ;; (function ...) form. (defalias 'syntax 'function) #+end_source This is a very hacky solution, but if you wanted to not modify the reader, you could add this to the beginning of init.el with the service. -- Reily Siegel From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 31 11:26:51 2023 Received: (at 60753) by debbugs.gnu.org; 31 Jan 2023 16:26:52 +0000 Received: from localhost ([127.0.0.1]:54817 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMtT9-0004No-KF for submit@debbugs.gnu.org; Tue, 31 Jan 2023 11:26:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMtT8-0004Nc-4U for 60753@debbugs.gnu.org; Tue, 31 Jan 2023 11:26:51 -0500 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 1pMtT2-00060B-Cb; Tue, 31 Jan 2023 11:26:44 -0500 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=+lMlov2gdsvCb80ct0ywK//v8R59oXPnr6AXJaiVB/k=; b=k7WHiyYBZmXzT65WoBvU WP9HrWJClgZiFPPSkjJV8ht926Y1rp3KNiDH8GD3Ubuix8eMENlNSbDhzEKYz1DWa1bKtYdp5bbZO SbksvECMZ4C1s3ykXSsPpNova1eta6O7A4ucYuNhTKyKydxR7UIgSuLGpcNtoRoGuMz/VZQyxogov VO2miXn1tWb53EXGsUEOjZLBZnYJ+1ilR0qwwhEc28g8ZCCH4h1i5ZBbdGN1YVLotwp+av6amwLYo zN46JuZJtXXTwQsgg/D1YwnIHHqU/Qp2kdaYY7nHkz1FJQgDv7wyn3PjrDSzXtDSblxclZgyb2UbK ElBqJpSRAEAzww==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMtT1-0003E3-SD; Tue, 31 Jan 2023 11:26:44 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andrew Tropin Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> <87mt6hjzyx.fsf@gnu.org> <87wn5l8bhz.fsf@trop.in> <87ilgx4kqg.fsf@gnu.org> <87v8ktvq99.fsf@trop.in> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Duodi 12 =?utf-8?Q?Pluvi=C3=B4se?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du Brocoli X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 31 Jan 2023 17:26:41 +0100 In-Reply-To: <87v8ktvq99.fsf@trop.in> (Andrew Tropin's message of "Thu, 26 Jan 2023 09:06:26 +0400") Message-ID: <87y1piu0u6.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-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60753 Cc: "\(" , David Wilson , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Andrew, Andrew Tropin skribis: >>> I think it will be cool to hook up a custom reader, ideally comment >>> preserving, for emacs lisp inside scheme files. >> >> (guix read-print) is what you want. :-) >> > > Can you give a hint on how to use it for preserving comments, please? It can be used like this: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use(guix read-print) scheme@(guile-user)> (pretty-print-with-comments (current-output-port) `(li= st foo ,(comment ";ooh!\n" #t) bar)) (list foo ;ooh! bar)$5 =3D 10 scheme@(guile-user)> (call-with-input-string "(list foo ;oh!\nbar)" read-wi= th-comments) $6 =3D (list foo #< str: ";oh!\n" margin?: #t> bar) --8<---------------cut here---------------end--------------->8--- There=E2=80=99s a record type. Now let=E2=80=99s see perhaps what we need to get =E2=80=98home-emacs-servi= ce-type=E2=80=99 merged, and what we can keep as future work. Thoughts? Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 01 07:59:54 2023 Received: (at 60753) by debbugs.gnu.org; 1 Feb 2023 12:59:54 +0000 Received: from localhost ([127.0.0.1]:56811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNCiP-0005SG-GH for submit@debbugs.gnu.org; Wed, 01 Feb 2023 07:59:54 -0500 Received: from mout01.posteo.de ([185.67.36.65]:46601) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNCiN-0005S3-DT for 60753@debbugs.gnu.org; Wed, 01 Feb 2023 07:59:52 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 8D3362405FF for <60753@debbugs.gnu.org>; Wed, 1 Feb 2023 13:59:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1675256385; bh=9qbnzqCFFiLos99ujlRS6vefX/3EXQbOBH/NiG8FG+M=; h=From:To:Cc:Subject:Date:From; b=aUe8Dh17Q1gh0fQmeJwcByoppt8FCjN4sRhxnjL5Gcq9URpm5PcYq3fGQQG9FWxb3 R+n8i4Pifkp6scDjae2v5YETTJRQEHOgcQJ0Y+Nr2IzkcbI/JSFCFqAPqROBJqpzpP A++yiSo9dKqMmp2kgP3Fah+bkqj0QyEfSE6MAhxWviF55xFiI8sshEyXLHOMx79Rdy TKoOJ1ASdQMZhZKM8gwI6fc9EzBkZAAQRMZCGnVtQWhJygV4iamTBXCPan7n5ylBex wwsp0ZV3xGarY/00kuwIpFTCWCFtPuW+l0Gcb1iD2pZYAxztln0k5rWtq2EiZ5Rb6I eYvqwxhLB5Xug== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4P6MSw2HFTz6tmX; Wed, 1 Feb 2023 13:59:43 +0100 (CET) From: Jelle Licht To: Andrew Tropin , Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. In-Reply-To: <87v8ktvq99.fsf@trop.in> References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> <87mt6hjzyx.fsf@gnu.org> <87wn5l8bhz.fsf@trop.in> <87ilgx4kqg.fsf@gnu.org> <87v8ktvq99.fsf@trop.in> Date: Wed, 01 Feb 2023 12:59:42 +0000 Message-ID: <87lelhils1.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60753 Cc: "\(" , David Wilson , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Andrew Tropin writes: > On 2023-01-23 11:18, Ludovic Court=C3=A8s wrote: > >> Hi, >> >> Andrew Tropin skribis: >> >>> On 2023-01-17 10:02, Ludovic Court=C3=A8s wrote: >>> >>>> Hi, >>>> >>>> Andrew Tropin skribis: >>>> >>>>>> What about accepting sexps (or gexps) instead of strings? As in: >>>>>> >>>>>> (init-file '((require 'whatever) (setq something t))) >>>>> >>>>> A quick minor note on this approach: it won't be possible to use >>>>> #'elisp-function inside such configuration because it will be >>>>> interpreted by guile reader, but actually rde lives without this >>>>> functionality completely ok. >>>> >>>> Specifically: >>>> >>>> (write '#'x) >>>> |=3D (syntax x) >>>> >>>> But we can use (guix read-print) and ensure that it prints #'. >>>> >>> >>> Do you have any links to docs/sample implementations on the topic of >>> extending guile reader, so we have an example to start with? >> >> It=E2=80=99s not the reader but rather the writer that we=E2=80=99d want= to tweak. > > Right, it already can read #'x as (syntax x) and we can print it > properly later, but AFAIK comments are ignored by the default reader. > So I would expect to do something (very roughly) like this: > > --8<---------------cut here---------------start------------->8--- > (parameterize (((@@ (guix gexp) read-procedure) read-with-comments)) > #~(list 'hello ; Comment I would like to preserve during serialization > 'guix)) > --8<---------------cut here---------------end--------------->8--- > > Of course it doesn't work, but I hope demonstrates the idea. > >> >> In (guix read-print), =E2=80=98pretty-print-with-comments=E2=80=99 alrea= dy special >> cases quasiquote etc. so that it prints =E2=80=98`=E2=80=99 (backtick) a= nd not >> =E2=80=98quasiquote'. We=E2=80=99d add clauses for =E2=80=98syntax=E2= =80=99 and =E2=80=98quasisyntax=E2=80=99. >> > > It seems ice-9 pretty-print also preserves backticks, but I see that > pretty-print-with-comments also preserves gexps, which is cool. Adding > syntax will make it even cooler. > >>> I think it will be cool to hook up a custom reader, ideally comment >>> preserving, for emacs lisp inside scheme files. >> >> (guix read-print) is what you want. :-) >> > > Can you give a hint on how to use it for preserving comments, please? > >>>>> Do we want something like this possible? >>>>> >>>>> (init-file `((require 'whatever) >>>>> (setq something t) >>>>> (load ,(local-file "old-init.el"))) >>>> >>>> It=E2=80=99d be nice. In that case, we=E2=80=99ll want it to be a gex= p though: >>>> >>>> #~((require 'whatever) (load #$(local-file =E2=80=A6))) >>>> >>> >>> gexps are nice, but do we really need/want them here? Do you have any >>> thoughts on what are the benifits over quasiquotes in this case? Maybe >>> some examples? >> >> The benefit in the example above is that the gexp would actually work >> whereas the sexp wouldn=E2=80=99t :-), unless there=E2=80=99s code somew= here to manually >> traverse the sexp adn replace the record with its store >> item (which is what gexps are about). >> >> I hope that makes sense! > > With this simple serializer we already achieved quite good results:=20 > https://git.sr.ht/~abcdw/rde/tree/388d3ad95e8607543df3dcdf26d058b610e7738= 9/src/rde/serializers/lisp.scm#L35 > > For this input > --8<---------------cut here---------------start------------->8--- > `((load ,(local-file "./feature-lists.scm")) > ,#~(format #f "hello") ; top level gexps are evaluated > (list ,#~(format #f "hello")) ; nested gexps are not > ,#~";; hacky comment" > ;; comment, which is not preserved > #'hi-fn ; incorrectly serialized, but fixable by alternative > ; pretty-print > ) > --8<---------------cut here---------------end--------------->8--- > > it provides quite satisfying results: > --8<---------------cut here---------------start------------->8--- > (load "/gnu/store/xb6ma0mcgg1zzq645s63arvy3qskmbiz-feature-lists.scm") > hello > (list (format #f "hello")) > ;; hacky comment > (syntax hi-fn) > --8<---------------cut here---------------end--------------->8--- > > It's a little incosistent (top level gexp are evaluated, but nested are > not), comments are not preserved and #' serialized incorrectly, but > other than that it works very good. > > WDYT about overall approach used here? or we can do it radically > better? Not saying it's better in any particular way, but I have had this locally for all my elisp-read-by-guile-written-back-to-elisp needs: --8<---------------cut here---------------start------------->8--- (define-module (jlicht build elisp-write) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:export (elisp-write)) (define (elisp-write in-list? exp port) "Stack-blowing implementation that writes guile's internal elisp representation to something that can be parsed by Emacs." ;; Definitions from (language elisp parser)'s quotation-symbols:=20 (define symbol-strings '((#{`}# . "`") (#{,}# . ",") (#{,@}# . ",@"))) (define (elisp-symbol? sym) (assq sym symbol-strings)) (define (write-elisp-symbol sym port) (format port "~A" (assq-ref symbol-strings sym))) =20=20 (match exp (((? elisp-symbol? sym) rest) (write-elisp-symbol sym port) (elisp-write in-list? rest port)) ;; Vector expression (#(vs ...) (format port "[") (elisp-write #t vs port) (format port "]")) ;; Guile elisp implementation detail ('(%set-lexical-binding-mode #f) 'skip) ;; List walker ((e ...) (when (not in-list?) (format port "(")) (unless (null? e) (elisp-write #f (car e) port) (for-each (lambda (v) (format port " ") (elisp-write #f v port)) (cdr e))) (when (not in-list?) (format port ")"))) ;; dotted pair ((and (? pair?) (? dotted-list? l)) (format port "(") (elisp-write #t (drop-right l 0) port) (format port " . ") (elisp-write #t (take-right l 0) port) (format port ")")) ;; Print simple primitives (_ (write exp port)))) --8<---------------cut here---------------end--------------->8--- On the reader side I just use guile's elisp reader: --8<---------------cut here---------------start------------->8--- (define-module (jlicht test elisp) #:use-module (language elisp parser) #:use-module (jlicht build elisp-write) #:use-module (srfi srfi-26) #:use-module (srfi srfi-64)) (eval-when (expand load eval) (read-hash-extend #\e (lambda (chr port) (read-elisp port)))) (set! test-log-to-file #f) (define (roundtrip expr) (let ((written (call-with-output-string (cut elisp-write #f expr <>)))) (call-with-input-string written read-elisp))) (define-syntax test-roundtrip-equals (syntax-rules () ((_ expr) (let ((e1 (roundtrip expr))) (test-equal e1 (roundtrip e1)))))) (define runner (test-runner-simple)) (test-with-runner runner (test-begin "roundtrip-elisp-fixed-point") (test-roundtrip-equals 12) (test-roundtrip-equals "hello") (test-roundtrip-equals '#e#'my-fn) (test-roundtrip-equals '#e[a b c]) (test-roundtrip-equals '#e`(+ 1 2 ,@(a b) ,c)) (test-end "roundtrip-elisp-fixed-point")) (exit (test-runner-fail-count runner)) --8<---------------cut here---------------end--------------->8--- I've also hooked it up in combination with a sequence of calls to `scheme-file' -> `computed-file' called `elisp-file', but that's a bit more hacky and less relevant to the current discussion. - Jelle From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 01 08:47:17 2023 Received: (at 60753) by debbugs.gnu.org; 1 Feb 2023 13:47:17 +0000 Received: from localhost ([127.0.0.1]:56870 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNDSG-0006fE-Ss for submit@debbugs.gnu.org; Wed, 01 Feb 2023 08:47:17 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:44077) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNDSB-0006ev-Sl for 60753@debbugs.gnu.org; Wed, 01 Feb 2023 08:47:16 -0500 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id 674AE20008; Wed, 1 Feb 2023 13:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1675259225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gJnLTYs6Ci+cdnKK4ckETem1FtZiznxuIkoEihwAUYo=; b=ILhIgxA6tx1G6jtUsGijebpOCDxyaJppf5ytDCOUKjhpm9oP2CHJOSYgQeoC0YLFyxRLHg a0PyKBwDMKIc+ZvzZy3rZjZWJPYn3eFmqX+bk50fvIjxvmZAJx4OIefkWXUljPZO+K7Kab HtvfIpa2TSf4F74eF/P9rIBimOexLjGs8LhUWHcxVUF9gEqTbICbcxdPqUbIMTXeYhnupl LMTRSlRx2HWAXPEEfEorHSCRVGd6HTb00DmgkymnlnfLPMN5GEASJH1Fn3qdjhRk0ldzoT GuNFbwmXXtF/8zgPqmMJV4Hhx6MesaWcEnUL1Ylg82KjdWjj6bVfLbY2nHdwfw== From: Andrew Tropin To: Jelle Licht , Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. In-Reply-To: <87lelhils1.fsf@posteo.net> References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> <87mt6hjzyx.fsf@gnu.org> <87wn5l8bhz.fsf@trop.in> <87ilgx4kqg.fsf@gnu.org> <87v8ktvq99.fsf@trop.in> <87lelhils1.fsf@posteo.net> Date: Wed, 01 Feb 2023 17:46:59 +0400 Message-ID: <87wn51qyzw.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60753 Cc: "\(" , David Wilson , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2023-02-01 12:59, Jelle Licht wrote: > Andrew Tropin writes: > >> On 2023-01-23 11:18, Ludovic Court=C3=A8s wrote: >> >>> Hi, >>> >>> Andrew Tropin skribis: >>> >>>> On 2023-01-17 10:02, Ludovic Court=C3=A8s wrote: >>>> >>>>> Hi, >>>>> >>>>> Andrew Tropin skribis: >>>>> >>>>>>> What about accepting sexps (or gexps) instead of strings? As in: >>>>>>> >>>>>>> (init-file '((require 'whatever) (setq something t))) >>>>>> >>>>>> A quick minor note on this approach: it won't be possible to use >>>>>> #'elisp-function inside such configuration because it will be >>>>>> interpreted by guile reader, but actually rde lives without this >>>>>> functionality completely ok. >>>>> >>>>> Specifically: >>>>> >>>>> (write '#'x) >>>>> |=3D (syntax x) >>>>> >>>>> But we can use (guix read-print) and ensure that it prints #'. >>>>> >>>> >>>> Do you have any links to docs/sample implementations on the topic of >>>> extending guile reader, so we have an example to start with? >>> >>> It=E2=80=99s not the reader but rather the writer that we=E2=80=99d wan= t to tweak. >> >> Right, it already can read #'x as (syntax x) and we can print it >> properly later, but AFAIK comments are ignored by the default reader. >> So I would expect to do something (very roughly) like this: >> >> --8<---------------cut here---------------start------------->8--- >> (parameterize (((@@ (guix gexp) read-procedure) read-with-comments)) >> #~(list 'hello ; Comment I would like to preserve during serialization >> 'guix)) >> --8<---------------cut here---------------end--------------->8--- >> >> Of course it doesn't work, but I hope demonstrates the idea. >> >>> >>> In (guix read-print), =E2=80=98pretty-print-with-comments=E2=80=99 alre= ady special >>> cases quasiquote etc. so that it prints =E2=80=98`=E2=80=99 (backtick) = and not >>> =E2=80=98quasiquote'. We=E2=80=99d add clauses for =E2=80=98syntax=E2= =80=99 and =E2=80=98quasisyntax=E2=80=99. >>> >> >> It seems ice-9 pretty-print also preserves backticks, but I see that >> pretty-print-with-comments also preserves gexps, which is cool. Adding >> syntax will make it even cooler. >> >>>> I think it will be cool to hook up a custom reader, ideally comment >>>> preserving, for emacs lisp inside scheme files. >>> >>> (guix read-print) is what you want. :-) >>> >> >> Can you give a hint on how to use it for preserving comments, please? >> >>>>>> Do we want something like this possible? >>>>>> >>>>>> (init-file `((require 'whatever) >>>>>> (setq something t) >>>>>> (load ,(local-file "old-init.el"))) >>>>> >>>>> It=E2=80=99d be nice. In that case, we=E2=80=99ll want it to be a ge= xp though: >>>>> >>>>> #~((require 'whatever) (load #$(local-file =E2=80=A6))) >>>>> >>>> >>>> gexps are nice, but do we really need/want them here? Do you have any >>>> thoughts on what are the benifits over quasiquotes in this case? Maybe >>>> some examples? >>> >>> The benefit in the example above is that the gexp would actually work >>> whereas the sexp wouldn=E2=80=99t :-), unless there=E2=80=99s code some= where to manually >>> traverse the sexp adn replace the record with its store >>> item (which is what gexps are about). >>> >>> I hope that makes sense! >> >> With this simple serializer we already achieved quite good results:=20 >> https://git.sr.ht/~abcdw/rde/tree/388d3ad95e8607543df3dcdf26d058b610e773= 89/src/rde/serializers/lisp.scm#L35 >> >> For this input >> --8<---------------cut here---------------start------------->8--- >> `((load ,(local-file "./feature-lists.scm")) >> ,#~(format #f "hello") ; top level gexps are evaluated >> (list ,#~(format #f "hello")) ; nested gexps are not >> ,#~";; hacky comment" >> ;; comment, which is not preserved >> #'hi-fn ; incorrectly serialized, but fixable by alternative >> ; pretty-print >> ) >> --8<---------------cut here---------------end--------------->8--- >> >> it provides quite satisfying results: >> --8<---------------cut here---------------start------------->8--- >> (load "/gnu/store/xb6ma0mcgg1zzq645s63arvy3qskmbiz-feature-lists.scm") >> hello >> (list (format #f "hello")) >> ;; hacky comment >> (syntax hi-fn) >> --8<---------------cut here---------------end--------------->8--- >> >> It's a little incosistent (top level gexp are evaluated, but nested are >> not), comments are not preserved and #' serialized incorrectly, but >> other than that it works very good. >> >> WDYT about overall approach used here? or we can do it radically >> better? > > Not saying it's better in any particular way, but I have had this locally > for all my elisp-read-by-guile-written-back-to-elisp needs: I saw it in guix-home-manager and probably you've made the thread on rde-devel too. I tried some parts of this code, but didn't succeed to get a complete working out of it, now I have a little more knowledge and hope will get better results :) > > --8<---------------cut here---------------start------------->8--- > (define-module (jlicht build elisp-write) > #:use-module (ice-9 match) > #:use-module (srfi srfi-1) > #:export (elisp-write)) > > (define (elisp-write in-list? exp port) > "Stack-blowing implementation that writes guile's internal elisp > representation to something that can be parsed by Emacs." > ;; Definitions from (language elisp parser)'s quotation-symbols:=20 > (define symbol-strings > '((#{`}# . "`") > (#{,}# . ",") > (#{,@}# . ",@"))) > (define (elisp-symbol? sym) > (assq sym symbol-strings)) > (define (write-elisp-symbol sym port) > (format port "~A" (assq-ref symbol-strings sym))) >=20=20=20 > (match exp > (((? elisp-symbol? sym) rest) > (write-elisp-symbol sym port) > (elisp-write in-list? rest port)) > ;; Vector expression > (#(vs ...) > (format port "[") > (elisp-write #t vs port) > (format port "]")) > ;; Guile elisp implementation detail > ('(%set-lexical-binding-mode #f) 'skip) > ;; List walker > ((e ...) > (when (not in-list?) (format port "(")) > (unless (null? e) > (elisp-write #f (car e) port) > (for-each (lambda (v) > (format port " ") > (elisp-write #f v port)) (cdr e))) > (when (not in-list?) (format port ")"))) > ;; dotted pair > ((and (? pair?) (? dotted-list? l)) > (format port "(") > (elisp-write #t (drop-right l 0) port) > (format port " . ") > (elisp-write #t (take-right l 0) port) > (format port ")")) > ;; Print simple primitives > (_ (write exp port)))) > --8<---------------cut here---------------end--------------->8--- > > On the reader side I just use guile's elisp reader: > > --8<---------------cut here---------------start------------->8--- > (define-module (jlicht test elisp) > #:use-module (language elisp parser) > #:use-module (jlicht build elisp-write) > #:use-module (srfi srfi-26) > #:use-module (srfi srfi-64)) > > (eval-when (expand load eval) > (read-hash-extend #\e (lambda (chr port) (read-elisp port)))) That's what I was looking for. If you have any links related to the topic of the reader extension, please let me know. > > (set! test-log-to-file #f) > > (define (roundtrip expr) > (let ((written (call-with-output-string (cut elisp-write #f expr <>)))) > (call-with-input-string written read-elisp))) > > (define-syntax test-roundtrip-equals > (syntax-rules () > ((_ expr) > (let ((e1 (roundtrip expr))) > (test-equal e1 (roundtrip e1)))))) > > (define runner (test-runner-simple)) > > (test-with-runner runner > (test-begin "roundtrip-elisp-fixed-point") > (test-roundtrip-equals 12) > (test-roundtrip-equals "hello") > (test-roundtrip-equals '#e#'my-fn) > (test-roundtrip-equals '#e[a b c]) > (test-roundtrip-equals '#e`(+ 1 2 ,@(a b) ,c)) It would be cool to make elisp-unquote for #e, but I think I can take a look at ungexp to understand how to implement it. > (test-end "roundtrip-elisp-fixed-point")) > > (exit (test-runner-fail-count runner)) > --8<---------------cut here---------------end--------------->8--- > > I've also hooked it up in combination with a sequence of calls to > `scheme-file' -> `computed-file' called `elisp-file', but that's a bit > more hacky and less relevant to the current discussion. > > - Jelle Thank you very much! =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmPabVMACgkQIgjSCVjB 3rCNKg/9HqXUnnKgo6sQGDDz8nkA0FkAsm0qCSS20Pa/vL3eZnD7umgSqADUXRyo b0N8Y/hhP/dU59AK/Lp3h4x9V6r/WmvK/oO2Ai9JQ2VLeeaUPwKDIlAOp/yBplDP zh/+xBcqy5lHfoTZI3TlgHDGTc0Ceb8L/PqGlc6kEwoOQP9VWg8XyoMpbvPp/m7u 7vQAHJZzK/WRN/NMxb4S6wTd22ZzP01Y5rRLdwiklGZM5U0osLcJCU2NaOiAJtWT HdbsA5S5auWeGTkk6pV9c3X4Qi7RTEm+M7/0piJE6pwmyw7LulDqZ/RczsxFnJrE z5hq7otbsBLMgsx3/7dcCwOTFTzgI0orw/tCHKq8Q1qqo7Rxizq5B9nuUKl/e1Ph yez13UTtCuuS2A6djyLHjD5sNIGCc/AEzdozauXvMKHQnRX8mEE0eSGCsu4FVqm0 pAYXvRrAxVsMjRmmklkIWETkqbbHbU2WT7cGs1i2gSlFPeljPbcLcFVp2PlL7GUt TvgpZ7hi3i2/n+UbeK0OlW+C+8KNuGBqitQwLeRzjDt8Np1FmT2ZahtRwwZ4ixs8 A5Lk7mvnMgDK06cjoOr8jDKgIkBDIKJHvoMINJ0ugAJV2MjTjv57YkGqIDR59+kS flGC+2qR+w57hGTcWZ67XorwpiwHQLOXNZ5/BPalmeycFpPsJEU= =JnjR -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 01 09:07:07 2023 Received: (at 60753) by debbugs.gnu.org; 1 Feb 2023 14:07:07 +0000 Received: from localhost ([127.0.0.1]:56894 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNDlT-0007Db-83 for submit@debbugs.gnu.org; Wed, 01 Feb 2023 09:07:07 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:45583) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNDlP-0007D2-MT for 60753@debbugs.gnu.org; Wed, 01 Feb 2023 09:07:06 -0500 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id 5DC9B240008; Wed, 1 Feb 2023 14:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1675260417; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2jQMfXOTsknEGbTe5sOuSWtHeb6VJwJyN508xPhdHeE=; b=hqJ/iloboz+Z44OnIxkJUD7DX9rTjgNYn6e6ZIRwCHAxFzRQFm9yJoiyvX1YOMKtq7hBQ9 K/XJcQAZijTgAOs0q0fA0WAjY2soOAiMRreb3mRq6EHZrLunF/isPCLuC23GR5pJS7UI60 ZunlUWPfcoaerU22ELVWDOyg9JyoDQkVz46Yva+1LIVro6uiP0euERxkqkbU5VXMZzlqCF 2IkV5JW3p8ABBY2KnKUyE25QGL2XDzPJrVa8SYYr4s+KOg9u5AeOYpaiWtfayPK55SyUhu ir+7H1KxN5gheOnqeqpBJPoiIxf1FLC8Imn8rIkm4HHKsNEnoxrD6VyvnIq9KQ== From: Andrew Tropin To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. In-Reply-To: <87y1piu0u6.fsf@gnu.org> References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> <87mt6hjzyx.fsf@gnu.org> <87wn5l8bhz.fsf@trop.in> <87ilgx4kqg.fsf@gnu.org> <87v8ktvq99.fsf@trop.in> <87y1piu0u6.fsf@gnu.org> Date: Wed, 01 Feb 2023 18:06:51 +0400 Message-ID: <87sffpqy2s.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60753 Cc: "\(" , David Wilson , 60753@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2023-01-31 17:26, Ludovic Court=C3=A8s wrote: > Hi Andrew, > > Andrew Tropin skribis: > >>>> I think it will be cool to hook up a custom reader, ideally comment >>>> preserving, for emacs lisp inside scheme files. >>> >>> (guix read-print) is what you want. :-) >>> >> >> Can you give a hint on how to use it for preserving comments, please? > > It can be used like this: > > --8<---------------cut here---------------start------------->8--- > scheme@(guile-user)> ,use(guix read-print) > scheme@(guile-user)> (pretty-print-with-comments (current-output-port) `(= list foo ,(comment ";ooh!\n" #t) bar)) > (list foo ;ooh! > bar)$5 =3D 10 > scheme@(guile-user)> (call-with-input-string "(list foo ;oh!\nbar)" read-= with-comments) > $6 =3D (list foo #< str: ";oh!\n" margin?: #t> bar) > --8<---------------cut here---------------end--------------->8--- > > There=E2=80=99s a record type. Yep, I already experimented with it, but it's not exactly what I'm looking for, Jelle gave a few ideas and code snippets which looks closer to what I searching. Pretty printer and read function are useful, but not directly related to my question about reader. > > Now let=E2=80=99s see perhaps what we need to get =E2=80=98home-emacs-ser= vice-type=E2=80=99 > merged, and what we can keep as future work. Thoughts? We have not perfect, but working quite good implementation of lisp serializer in rde, which we use in rde's home-emacs-service-type: https://git.sr.ht/~abcdw/rde/tree/d0ea604282c9aeb0b121f51979373b4aa40f9bcb/= item/tests/rde/serializers/lisp-test.scm https://git.sr.ht/~abcdw/rde/tree/d0ea604282c9aeb0b121f51979373b4aa40f9bcb/= item/src/rde/home/services/emacs.scm#L93 But I'm not completely satisfyied with it and don't want to upstream it in current state, I plan to experiment with Jelle's code and get a feeling of how his approach works, also want to dive into reader extensions topic. If I get satisfying solution I will share it. It can take quite a while, so don't expect it to happen anytime soon; it can, but unlikely :) If anyone want to work in parallel and propose alternative implementation, I would be glad to give a feedback on it. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmPacfsACgkQIgjSCVjB 3rDluhAAkfK/QMnJXcUra3mqobY+rtkI86mjyT6fgaY8kFDu0NFWcXLghwohRax1 4s8/sFf8LDJGwmgZgl9Cr7+WmL4ocnmoPCccWaBzUVfXJr7vce3XTgEVAP4exICS BbVEVhkrJfZk2AKHDaGqGfVHMVsS5jIYEzLD4Ye5UfFMkrFJf1kqFeS1V/YWchO1 ppV9rM5V+IS9ViludZ1UY26c9RQprqkGHUGcZpxH+NNRQefNrfhEL89ZQrtBu5GQ vXjugmojrEtDs8R78RTJdufzPORGr8fUcUEhcDbsRW1DVZ7lgP5VA56MIavIeTuO iR8wARu8oZ//MwRCeWmp2mBA4efCveU78DiMk0lfo3jDwxO3L4PClAs5itEJacTf Vz3Sr1++/5lUw5P1oVYGiBIEZqyjLKG8Vz+kRlV1/PEwaF2uhRDSRcHtDioM/3a+ Xa9S8KrfmIZvmyp/JgxXJGZUVZ5QgPXrAoHarnORijxgFcOIbbOtyBdNTwvgb4Y4 /4Jz3TymwMYY761Dx2xnbZGCxLJJvvnAAdQZIKe1j9Ix6K1MFwfXvkM8/KoqQ0LO jiGzDIp1RIRaHiobboIa22bvHVl+Wa9Jr8TdrMVYnntDErlBv9fxyYoXVsM+SWm/ 86BRhx4HDRyIYIu+XQI7OK5HqDE7R93/Vk+PEAz1v7/bjEXANeo= =hT1d -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 10 02:53:42 2023 Received: (at 60753) by debbugs.gnu.org; 10 Feb 2023 07:53:43 +0000 Received: from localhost ([127.0.0.1]:34246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQOE2-0000WT-Jy for submit@debbugs.gnu.org; Fri, 10 Feb 2023 02:53:42 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:33151) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQOE1-0000WD-DW for 60753@debbugs.gnu.org; Fri, 10 Feb 2023 02:53:41 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 5B8F65C00A6; Fri, 10 Feb 2023 02:53:35 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 10 Feb 2023 02:53:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daviwil.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1676015615; x= 1676102015; bh=L5anpdgH4AMZyemFMFmN4iWLK9IUioCkZ5j+gAbfjjA=; b=j hzOIj0/M9b1oWWIuEyLDFmbq2B7aTWuBpVB0h32oVIgIgI6xXj61riGPtX5som/s WY7bn+FVfQBIPlmlXTYnjxs3FkrTjv1lbglqa6zjH4NFLeSoQffTIwZyMViHF8GL VJi+nBw5Tc7WEEhSNfVhZXwFZakeXuxJq7/a2+pOHN9JloWXm9GmaTty1cFW8pj4 0cq0Wz0fqRGwtd2dkSpb7MXHxEKG67m6cL8KzXaykXC17ZEvWdb6BR+8cvJ5DAXt yGqlErGilR7K63Y80pUIqTP7gWdaZQ48rJ/jFHNe3gkgypjwqTjKF0CL8zBdylaR GEaY3NP+NY0Eo1nL86zkA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1676015615; x= 1676102015; bh=L5anpdgH4AMZyemFMFmN4iWLK9IUioCkZ5j+gAbfjjA=; b=V DZ6YymqMNvE9YuUwhRasuRsi2Bup1dLLemxRrnLFHK91hPcpPAh6GdFZ2Mv5UShG R/sCFyWUJwtgGjxZZvUmcACyW9sYR7tcymoEejALoezRrt5cFUyeZY6sC3uT/00C 3SwfmjCo7wmZ3CfiUDGYyZ7DTtNN698Wqh8qhGHW7o/wuj87+2uSQdoHVWl1U3il FTIz4pVyUgVHKJJisLZ5FleGp+fwBT+ghrQ4aOnuK+PC2MALGzZRgul38ccnprwo XkD0h7YDWiNV1hYBinSbG3DltJob+A7/xwCSKLvHTF6cH8jRZe8mDmF3RHJZZdSh FEjxS3rW6FWxDHshjO5Zg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudehgedguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpehffgfhvfevufffjgfkgggtgfesthhqredttderjeenucfhrhhomhepffgr vhhiugcuhghilhhsohhnuceouggrvhhiugesuggrvhhifihilhdrtghomheqnecuggftrf grthhtvghrnhepuddtgfeiheehhfdtfeegveeghefghedugeevhfduieejhefghfduhfev tdejgeffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epuggrvhhiugesuggrvhhifihilhdrtghomh X-ME-Proxy: Feedback-ID: iba684179:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 10 Feb 2023 02:53:33 -0500 (EST) References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> <87mt6hjzyx.fsf@gnu.org> <87wn5l8bhz.fsf@trop.in> <87ilgx4kqg.fsf@gnu.org> <87v8ktvq99.fsf@trop.in> <87y1piu0u6.fsf@gnu.org> User-agent: mu4e 1.8.13; emacs 29.0.50 From: David Wilson To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. Date: Fri, 10 Feb 2023 09:50:03 +0200 In-reply-to: <87y1piu0u6.fsf@gnu.org> Message-ID: <875ycaq7lx.fsf@daviwil.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 60753 Cc: "\(" , 60753@debbugs.gnu.org, Andrew Tropin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Ludovic Court=C3=A8s writes: > Now let=E2=80=99s see perhaps what we need to get =E2=80=98home-emacs-ser= vice-type=E2=80=99 > merged, and what we can keep as future work. Thoughts? Sorry for the long delay in getting back to this! To summarize what we've discussed so far: - It's possibly best to use g-expressions for the init.el file contents because it gives ultimate flexibility on how one can describe their Emacs configuration in Scheme while pulling in files from their local configuration folder. Are we concerned whether this may be harder for users to understand and adopt? - We'll postpone any work to ensure that comments and #'function references can be properly represented so that we can get the basic `home-emacs-service' merged for now. Future patches will improve on that situation. Is that accurate? Either way, I'll spend some time today responding to the feedback so that we can get this merged. Thanks! David From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 20 06:10:19 2023 Received: (at 60753) by debbugs.gnu.org; 20 Feb 2023 11:10:19 +0000 Received: from localhost ([127.0.0.1]:50663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU43n-0004kL-11 for submit@debbugs.gnu.org; Mon, 20 Feb 2023 06:10:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pU43l-0004k3-Ow for 60753@debbugs.gnu.org; Mon, 20 Feb 2023 06:10:18 -0500 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 1pU43f-0005xW-7R; Mon, 20 Feb 2023 06:10:11 -0500 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=sxiCr+/gI9dK5RNKxztSNbqBID9PvXlEzAnAy2rpHyU=; b=o7RMG1eyNS3fmA2bQOhG yVYrVu9M/6s8jp5GsXxfWVZoGHz8a7d84ddZFqe77bX3xoFbrakEZBaOjCatwXovZP9wQo+14meRJ l0wUODMCn6bq9SvluqUaoM9YSy47Iiv+hytKvfODRIUHqDKBgRcIvA68YDRMmx9eLslk/n/aoR+q6 1QZ6OyYNz+jLb7uVahfJNZLkdCgOTzXaEUTA0/90KWJTKnblRsPcQ6tPZRDftBR46O0DFd73Xou10 8jEik+B50sjAdU+TDkvvFbMwrf4e1J2L+skPF072KvAKkgCtcNtdCsqHZkfhFmXxC4fiJL5owKRQk NQrp5leiPMScIg==; Received: from [193.50.110.154] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU43e-00013j-Nb; Mon, 20 Feb 2023 06:10:10 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: David Wilson Subject: Re: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. References: <87edrzzw9w.fsf@daviwil.com> <87v8lby7jq.fsf@daviwil.com> <87k01p8086.fsf_-_@gnu.org> <87cz7g2pkz.fsf@trop.in> <87mt6hjzyx.fsf@gnu.org> <87wn5l8bhz.fsf@trop.in> <87ilgx4kqg.fsf@gnu.org> <87v8ktvq99.fsf@trop.in> <87y1piu0u6.fsf@gnu.org> <875ycaq7lx.fsf@daviwil.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Duodi 2 =?utf-8?Q?Vent=C3=B4se?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du Cornouiller X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 20 Feb 2023 12:10:07 +0100 In-Reply-To: <875ycaq7lx.fsf@daviwil.com> (David Wilson's message of "Fri, 10 Feb 2023 09:50:03 +0200") Message-ID: <87a618iods.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-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60753 Cc: "\(" , 60753@debbugs.gnu.org, Andrew Tropin X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi David, David Wilson skribis: > Ludovic Court=C3=A8s writes: > >> Now let=E2=80=99s see perhaps what we need to get =E2=80=98home-emacs-se= rvice-type=E2=80=99 >> merged, and what we can keep as future work. Thoughts? > > Sorry for the long delay in getting back to this! To summarize what > we've discussed so far: > > - It's possibly best to use g-expressions for the init.el file contents > because it gives ultimate flexibility on how one can describe their > Emacs configuration in Scheme while pulling in files from their local > configuration folder. Are we concerned whether this may be harder for > users to understand and adopt? Ease of use should always be a concern IMO. I=E2=80=99d expect that writing gexps will feel more convenient than in sexps-in-Scheme-strings for the target Elisp audience. > - We'll postpone any work to ensure that comments and #'function > references can be properly represented so that we can get the basic > `home-emacs-service' merged for now. Future patches will improve on > that situation. > > Is that accurate? Either way, I'll spend some time today responding to > the feedback so that we can get this merged. Sounds good to me! Ludo=E2=80=99.