Message ID | 20220802214236.18965-1-ludo@gnu.org |
---|---|
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E0D1F27BBEA; Tue, 2 Aug 2022 23:59:19 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8B07F27BBE9 for <patchwork@mira.cbaines.net>; Tue, 2 Aug 2022 23:59:19 +0100 (BST) Received: from localhost ([::1]:57594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org>) id 1oIzfQ-00016Z-Ju for patchwork@mira.cbaines.net; Tue, 02 Aug 2022 17:43:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oIzfK-00016H-9i for guix-patches@gnu.org; Tue, 02 Aug 2022 17:43:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oIzfK-00062j-16 for guix-patches@gnu.org; Tue, 02 Aug 2022 17:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1oIzfJ-00032M-SL for guix-patches@gnu.org; Tue, 02 Aug 2022 17:43:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56898] [PATCH 00/13] Put the pretty printer to good use Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 02 Aug 2022 21:43:01 +0000 Resent-Message-ID: <handler.56898.B.165947657011645@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56898 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56898@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165947657011645 (code B ref -1); Tue, 02 Aug 2022 21:43:01 +0000 Received: (at submit) by debbugs.gnu.org; 2 Aug 2022 21:42:50 +0000 Received: from localhost ([127.0.0.1]:45245 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1oIzf8-00031k-28 for submit@debbugs.gnu.org; Tue, 02 Aug 2022 17:42:50 -0400 Received: from lists.gnu.org ([209.51.188.17]:44902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@gnu.org>) id 1oIzf5-00031c-8m for submit@debbugs.gnu.org; Tue, 02 Aug 2022 17:42:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@gnu.org>) id 1oIzf5-00013T-2h for guix-patches@gnu.org; Tue, 02 Aug 2022 17:42:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55118) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@gnu.org>) id 1oIzf4-00061Q-1f; Tue, 02 Aug 2022 17:42:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=up9+IDRMX04HY/f0S2mr+7/rjyeOmeD9pY7lgj7dl70=; b=hJNRrs6dm1aqAU 1iYY/qSev0qh2iwA8+qBQ2flnn1AYI9rb3iUXEtfitdpb3U1sAGDw5meo64AANvEJz5ZPhWEgr/Zj YFMnsJBjDwE6avWwAErFcS32OFSelQCq3Jf5evH24/foHPN3QW86PnBUisNvnoGubSHNo652vxboD ajV+JfnuRseojGE4ZPUffNe+a5v1spWyQQhnIiQNbptCYFt+MEingFCtXX5Q6mYG1x1n925oZJ11u uOfpZq+/T0hz33bg1Po+/EIaQnamuffTMlizKeze0uVtUA5GXaFCo5JyWKNyFoVRBirCJ/p8EUsr6 c5S1Xd61dsRRgt5zZlzA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:59102 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <ludo@gnu.org>) id 1oIzf3-0006Qz-LC; Tue, 02 Aug 2022 17:42:45 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> Date: Tue, 2 Aug 2022 23:42:36 +0200 Message-Id: <20220802214236.18965-1-ludo@gnu.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-getmail-retrieved-from-mailbox: Patches |
Series |
Put the pretty printer to good use
|
|
Message
Ludovic Courtès
Aug. 2, 2022, 9:42 p.m. UTC
Hello Guix! I shaved a yak! This patch series promotes the pretty reader/printer of ‘guix style’ to its own module, improves it so it can deal with vertical space, adds a ‘-f’ option to ‘guix style’ to reformat whole files, changes the installer to use this pretty-printer, and changes the installer so it emits comments and vertical space in the generated configuration. You can use ‘guix style -f’ on any Scheme file. The pretty-printer does a decent job, though there are still cases where it’s not as good as my little hands at formatting things nicely. For newcomers, it should be very helpful. Comments? Vertical space? Page breaks? Ludo’. Ludovic Courtès (13): style: Move reader and printer to (guix read-print). read-print: Add System and Home special forms. read-print: Expose comment constructor. read-print: Introduce <blank> parent class of <comment>. style: Adjust test to not emit blank lines. read-print: Read and render vertical space. read-print: Recognize page breaks. read-print: Add code to read and write sequences of expressions/blanks. read-print: 'canonicalize-comment' leaves top-level comments unchanged. style: Add '--whole-file' option. read-print: Support printing multi-line comments. installer: Render the final configuration with (guix read-print). installer: Add comments and vertical space to the generated config. Makefile.am | 3 + doc/guix.texi | 28 +- gnu/installer.scm | 3 +- gnu/installer/parted.scm | 10 +- gnu/installer/services.scm | 39 ++- gnu/installer/steps.scm | 32 +- gnu/installer/user.scm | 7 +- guix/read-print.scm | 678 +++++++++++++++++++++++++++++++++++++ guix/scripts/import.scm | 4 +- guix/scripts/style.scm | 527 +++------------------------- tests/guix-style.sh | 80 +++++ tests/read-print.scm | 358 ++++++++++++++++++++ tests/style.scm | 185 +--------- 13 files changed, 1270 insertions(+), 684 deletions(-) create mode 100644 guix/read-print.scm create mode 100644 tests/guix-style.sh create mode 100644 tests/read-print.scm base-commit: d7e7494bc4d69de9db49488ee812e572c3250211
Comments
Hey Ludo, Wow, nice! I tested the installer part, everything seems to work fine and the new comments are a welcomed addition. Thanks, Mathieu
Hi Mathieu, Mathieu Othacehe <othacehe@gnu.org> skribis: > Wow, nice! I tested the installer part, everything seems to work fine > and the new comments are a welcomed addition. Thanks for taking a look, I’m glad you liked it! I guess we could add more comments in the generated OS config to guide people; I wasn’t sure where to add them and how to frame them, but we can do that later. Ludo’.
Ludovic Courtès <ludo@gnu.org> skribis: > style: Move reader and printer to (guix read-print). > read-print: Add System and Home special forms. > read-print: Expose comment constructor. > read-print: Introduce <blank> parent class of <comment>. > style: Adjust test to not emit blank lines. > read-print: Read and render vertical space. > read-print: Recognize page breaks. > read-print: Add code to read and write sequences of > expressions/blanks. > read-print: 'canonicalize-comment' leaves top-level comments > unchanged. > style: Add '--whole-file' option. > read-print: Support printing multi-line comments. > installer: Render the final configuration with (guix read-print). > installer: Add comments and vertical space to the generated config. Oops, forgot to close: I pushed this series as ff9522fb69b9f4a31a5b766029e26dc53a2d1cf8 yesterday. Lemme know how it goes! Ludo’.