read-print: Be more mindful of horizontal space in packages.

Perhaps due to their staged nature, packages tend to be ‘lopsided’: deeply
nested, with the most elaborate code on the {build,right-hand-,in}side, in
snippets and phases.

When we indent outer forms too eagerly, we can easily run short on
columns by the time we get to the build code, reducing readability.  A
few strategically-placed newlines early on can make a big difference.

* guix/read-print.scm (%newline-forms): Add a newline after opening a
<package> source field or an argument list.  Compensate by removing the
base32 special case, which is now unnecessary.
This commit is contained in:
Tobias Geerinckx-Rice 2023-09-24 02:00:00 +02:00
parent 2bae0081f9
commit 974b04ab80
No known key found for this signature in database
GPG key ID: 0DB0FF884F556D79

View file

@ -359,10 +359,11 @@ (define %newline-forms
;; the context in which they must appear. This is similar to a special form ;; the context in which they must appear. This is similar to a special form
;; of 1, except that indent is 1 instead of 2 columns. ;; of 1, except that indent is 1 instead of 2 columns.
(vhashq (vhashq
('arguments '(package)) ('source '(package))
('sha256 '(origin source package))
('base32 '(sha256 origin))
('git-reference '(uri origin source)) ('git-reference '(uri origin source))
('sha256 '(origin source package))
('arguments '(package))
('list '(arguments package))
('search-paths '(package)) ('search-paths '(package))
('native-search-paths '(package)) ('native-search-paths '(package))
('search-path-specification '()) ('search-path-specification '())