style: Allow special forms to be scoped.

* guix/scripts/style.scm (vhashq): Add clause for 'lst, and change
default clause.
(%special-forms): Add context for 'add-after and 'add-before.  Add
'replace.
(prefix?, special-form-lead): New procedures.
(special-form?): Remove.
(pretty-print-with-comments): Add 'context' to the threaded state.
Adjust 'print-sequence' and adjust 'loop' calls accordingly.
* tests/style.scm: Add tests for 'replace.
This commit is contained in:
Ludovic Courtès 2022-01-03 09:05:54 +01:00
parent 97d0055edb
commit 208a7aa17b
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 73 additions and 27 deletions

View file

@ -453,6 +453,18 @@ mnopqrstuvwxyz.\")"
\"abcdefghijklmnopqrstuvwxyz\")"
#:max-width 33)
(test-pretty-print "\
(modify-phases %standard-phases
(replace 'build
;; Nicely indented in 'modify-phases' context.
(lambda _
#t)))")
(test-pretty-print "\
(modify-inputs inputs
;; Regular indentation for 'replace' here.
(replace \"gmp\" gmp))")
(test-end)
;; Local Variables: