From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id IKOnCIYK0mOZ7QAAbAwnHQ (envelope-from ) for ; Thu, 26 Jan 2023 06:07:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id yCG4CIYK0mNDkgAAauVa8A (envelope-from ) for ; Thu, 26 Jan 2023 06:07:18 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1EFC93067D for ; Thu, 26 Jan 2023 06:07:17 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKuTZ-0001Nd-Ll; Thu, 26 Jan 2023 00:07:05 -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 1pKuTX-0001NU-Iv for guix-patches@gnu.org; Thu, 26 Jan 2023 00:07:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pKuTW-0007tp-Ay for guix-patches@gnu.org; Thu, 26 Jan 2023 00:07:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pKuTV-0001FE-OG for guix-patches@gnu.org; Thu, 26 Jan 2023 00:07:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60753] [PATCH] gnu: home: Add home-emacs-service-type. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 26 Jan 2023 05:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60753 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: "\(" , David Wilson , 60753@debbugs.gnu.org Received: via spool by 60753-submit@debbugs.gnu.org id=B60753.16747096034749 (code B ref 60753); Thu, 26 Jan 2023 05:07:01 +0000 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 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1674709637; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=yUhI8VVgrGEyiEis21QUkoO9ZG4bJetiX+GjRsVHAZk=; b=pDHS1PYvR4wBp5ENR0r5zFoTGV3eLihqz+ojJFOeu1/sd1tM8WGxLCZ71n2s9YM3SFtkb5 IfHflpENeKyssVu1Wzrs6itOps9QDnb9jjhg2GGdPWc/aa4Y/DShBNjQT76ad1vit5lU74 pL1Dtez9+zcjslbs6FmFBuz6k2pXBvzJowONnH3vc9N605JKsMsIiyR1njFHVOZAIRkr5o 5yXRpia8zmbybILh5/UdfU/ROlVlVGjpw69WF4UfiWtVfDex5/Ah2Hp5P/d+JLDY2TnYWv 4g9hWZJ5Rf1v9gKM4HERlmQ+/tmoKC76U0KWfdc74FuZpDe3pDp729rrhI/Oyg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=lRLYBYnd; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1674709637; a=rsa-sha256; cv=none; b=VQcQHdpnevW9au7w5KFHYvYL9mgepnL6vp+UR8cOz76eKPEjDV0Rc3HILH2Lc8u2Qp3Xsi JF0YXRm/+VZzMtpdHs0rur3xW2NXCBmPFOwLk7eVGJs5eHMwYIqJx3gbe5VlK/ctv03VUQ Zr9yVXvQ5BE5lg5phODQ/yUW4T1c1cqO2AAuYAAIx37uemkpC27aIk844iaBjhbrAxZhkN XX2vTtKWY63iWyvU3mUy7SeBgdZD66H4PSTW3E+vAuzwX+POD4rmSzgyBqZBVrxHY4K/nI 1rOJQwR0sMxO14F1TfzMpxc5IYirUA7Oh1BQRqAS4t6joLqKuA7AqN9QDLE9AQ== X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=lRLYBYnd; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none X-Migadu-Spam-Score: -1.28 X-Spam-Score: -1.28 X-Migadu-Queue-Id: 1EFC93067D X-TUID: HKFMp3zdFvir --=-=-= 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----- --=-=-=--