From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EJ9cF26a6WLhZQEAbAwnHQ (envelope-from ) for ; Tue, 02 Aug 2022 23:43:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id gOtoF26a6WKbyAAA9RJhRA (envelope-from ) for ; Tue, 02 Aug 2022 23:43:10 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0E4313D385 for ; Tue, 2 Aug 2022 23:43:10 +0200 (CEST) Received: from localhost ([::1]:57594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIzfR-00016Z-7n for larch@yhetil.org; Tue, 02 Aug 2022 17:43:09 -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 ) 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 ) 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 ) 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?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 02 Aug 2022 21:43:01 +0000 Resent-Message-ID: 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?= 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 ) 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 ) 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 ) 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 ) 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 ) id 1oIzf3-0006Qz-LC; Tue, 02 Aug 2022 17:42:45 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659476590; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=up9+IDRMX04HY/f0S2mr+7/rjyeOmeD9pY7lgj7dl70=; b=AdnYOcxlqEebbGCZiHKWSv55CDnWCdvlXp6pXWvMXSEQzpjAEuOX5wBr+2jEX7XXaaavvx jUS+9OoeG/R/W1yvW2EeNt0Oy6ojs21tQhbplHg4rJTDmVdRp+6fY/dmNaJbgVicJdeaec veRD+ZZOzE+mis2/9zXbSZR1R775/hs6ieUJarP/ydXee2NdPu/qMPqDlXu7MYuOrYcSo2 Nf5FuaXvlgsK4lg7FLL9SAzBptRv2YQoQ2gvAuVAXti86+XQc/RwjDEuzgymd0rZO4ff3T kvqLKmHduOc+JEBgCCuKx9QA/QTaUoVFA9COcLfWSAYXCeC0dZ0XB8eM3XscRA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659476590; a=rsa-sha256; cv=none; b=Zcq8RStelLFuHEFmDwdnomM9xywio1jPceIYhwAtTtf5Fexbodbsy8VMI0n2W701Iqu4eb mi/D5kIZqWcM0gTcTIysIo5W8Qunl9XkUXEDw/Wag/404bIxZrmP1OwvyplEfu1Adx3IXZ U+HXvRUAshJTiljsUs+3cMAeF13Z2BgoVjxfAvfbnyO2WqK5rBRgd3RusZJrONPNDbl7Vi zpAkGIqeCNfGurybZ7HF78OWFUZfA5pTzciQ+hCxgLDmU8QYqxgfYGjtXe5TubKv/rDlmY pWCLa0l5fFu8FKygK/nz+xspBbH3zs+DORF6M0yMJjHiPNlGEeeAeyeIc27U1Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=hJNRrs6d; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Spam-Score: -2.82 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=hJNRrs6d; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Queue-Id: 0E4313D385 X-Spam-Score: -2.82 X-Migadu-Scanner: scn1.migadu.com X-TUID: Uy6CQnoVTysp 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 parent class of . 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 -- 2.37.1