From: "Ludovic Courtès" <ludo@gnu.org>
To: 52974@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#52974] [PATCH 0/5] Formatting package definitions with 'guix style'
Date: Mon, 3 Jan 2022 11:53:35 +0100 [thread overview]
Message-ID: <20220103105335.13164-1-ludo@gnu.org> (raw)
Hello Guix!
This patch set extends ‘guix style’ so that it can format
package definitions following our conventions. It adds a
new ‘-S’ option to ‘guix style’, which allows you to select
a “styling rule”.
To obtain the same behavior as before, you now need to run
‘guix style -S inputs’ (this is an incompatibility); ‘guix
style’ alone is equivalent to ‘guix style -S format’, which
formats the given package definition(s).
The code of the pretty printer is not pretty, but it does a
rather good job, notably because it recognizes our special
forms and rules, unlike ‘pretty-print’. I’m sure we could
spend months tweaking it, but I think it’s reached the point
where we can recommend it.
This nicely replaces ‘etc/indent-code.el’ and will hopefully
make the lives of contributors easier.
Thoughts?
Eventually we should change importers to use this instead of
(ice-9 pretty-print). I also envision a rule to rewrite Rust
packages to look like regular packages, as discussed earlier
with Efraim, which will benefit from this work.
Ludo’.
Ludovic Courtès (5):
style: Improve pretty printer and add tests.
style: Allow special forms to be scoped.
style: Add support for "newline forms".
style: Add '--styling' option.
style: '-S format' canonicalizes comments.
doc/contributing.texi | 18 +-
doc/guix.texi | 60 +++++-
etc/indent-code.el | 120 ------------
guix/scripts/style.scm | 415 +++++++++++++++++++++++++++++++++++------
tests/style.scm | 162 +++++++++++++++-
5 files changed, 571 insertions(+), 204 deletions(-)
delete mode 100755 etc/indent-code.el
base-commit: 637dec9d45db4df2a3e6aa565fa2c5cf6bb77768
--
2.33.0
next reply other threads:[~2022-01-03 10:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-03 10:53 Ludovic Courtès [this message]
2022-01-03 11:24 ` [bug#52974] [PATCH 1/5] style: Improve pretty printer and add tests Ludovic Courtès
2022-01-03 11:24 ` [bug#52974] [PATCH 2/5] style: Allow special forms to be scoped Ludovic Courtès
2022-01-03 11:24 ` [bug#52974] [PATCH 3/5] style: Add support for "newline forms" Ludovic Courtès
2022-01-03 11:24 ` [bug#52974] [PATCH 4/5] style: Add '--styling' option Ludovic Courtès
2022-01-03 11:24 ` [bug#52974] [PATCH 5/5] style: '-S format' canonicalizes comments Ludovic Courtès
2022-01-10 14:03 ` bug#52974: [PATCH 0/5] Formatting package definitions with 'guix style' Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220103105335.13164-1-ludo@gnu.org \
--to=ludo@gnu.org \
--cc=52974@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).