Age | Commit message (Expand) | Author |
2022-08-08 | style: Add '--whole-file' option....* guix/scripts/style.scm (format-whole-file): New procedure.
(%options, show-help): Add '--whole-file'.
(guix-style): Honor it.
* tests/guix-style.sh: New file.
* Makefile.am (SH_TESTS): Add it.
* doc/guix.texi (Invoking guix style): Document it.
| Ludovic Courtès |
2022-08-08 | read-print: Read and render vertical space....* guix/read-print.scm (<vertical-space>, vertical-space?)
(vertical-space, vertical-space-height): New variables.
(combine-vertical-space, canonicalize-vertical-space)
(read-vertical-space): New procedures.
(read-with-comments): Use it in the #\newline case.
(pretty-print-with-comments): Add #:format-vertical-space and honor it.
Add case for 'vertical-space?'.
* guix/scripts/style.scm (format-package-definition): Pass
#:format-vertical-space to 'object->string*'.
* tests/read-print.scm ("read-with-comments: list with blank line")
("read-with-comments: list with multiple blank lines")
("read-with-comments: top-level blank lines")
("pretty-print-with-comments, canonicalize-vertical-space"): New tests.
Add a couple of additional round-trip tests.
| Ludovic Courtès |
2022-08-08 | read-print: Introduce <blank> parent class of <comment>....* guix/read-print.scm (<blank>, blank?): New record type.
(<comment>): Redefine using the record interface.
(read-with-comments, pretty-print-with-comments): Change some uses of
'comment?' to 'blank?'.
* guix/scripts/style.scm (simplify-inputs)[simplify-expressions]: Use
'blank?' instead of 'comment?'.
| Ludovic Courtès |
2022-08-08 | style: Move reader and printer to (guix read-print)....* guix/scripts/style.scm (<comment>, read-with-comments)
(vhashq, %special-forms, %newline-forms, prefix?)
(special-form-lead, newline-form?, escaped-string)
(string-width, canonicalize-comment, pretty-print-with-comments)
(object->string*): Move to...
* guix/read-print.scm: ... here. New file.
* guix/scripts/import.scm: Adjust accordingly.
* tests/style.scm: Move 'test-pretty-print' and tests to...
* tests/read-print.scm: ... here. New file.
* Makefile.am (MODULES): Add 'guix/read-print.scm'.
(SCM_TESTS): Add 'tests/read-print.scm'.
| Ludovic Courtès |
2022-07-12 | style: Gracefully handle failure to locate a source file....* guix/scripts/style.scm (absolute-location): Raise an error when
'search-path' returns #f.
| Ludovic Courtès |
2022-07-04 | style: For 'let' and similar forms, emit one binding per line....Previously, 'let' bindings could be rendered like this:
(let ((x 1) (y 2)
(z 3))
...)
With this change, each bindings goes in its own line.
Partly fixes <https://issues.guix.gnu.org/56297>.
Reported by Maxime Devos <maximedevos@telenet.be>.
* guix/scripts/style.scm (pretty-print-with-comments)[list-of-lists?]:
New procedure.
Use it.
* tests/style.scm: Add tests with 'let' and 'substitute-keyword-arguments'.
| Ludovic Courtès |
2022-07-04 | style: Add option '--list-stylings'....* guix/scripts/style.scm (show-stylings): New procedure.
(%options, show-help): Add "--list-stylings".
* doc/guix.texi (Invoking guix style): Document "-l".
| Hartmut Goebel |
2022-06-22 | style: Keep values next to their keyword....This ensures we print '#:key value' rather than insert a newline
between '#:key' and 'value' as was the case before.
* guix/scripts/style.scm (pretty-print-with-comments)[print-sequence]:
When ITEM is a keyword, loop with FIRST? = true.
* tests/style.scm: Add test.
| Ludovic Courtès |
2022-04-14 | style: Correctly read dots in pairs and improper lists....Until now dots were read as symbols.
* guix/scripts/style.scm (read-with-comments)[dot]: New variable.
[dot?, reverse/dot]: New procedures.
Use 'reverse/dot' instead of 'reverse' when reading lists.
* tests/style.scm ("read-with-comments: dot notation")
("((a . 1) (b . 2))", "(a b c . boom)"): New tests.
| Ludovic Courtès |
2022-01-10 | style: '-S format' canonicalizes comments....* guix/scripts/style.scm (canonicalize-comment): New procedure.
(pretty-print-with-comments): Add #:format-comment. and honor it.
(object->string*): Add 'args' and honor them.
(format-package-definition): Pass #:format-comment to
'object->string*'.
* tests/style.scm ("pretty-print-with-comments, canonicalize-comment"):
New test.
| Ludovic Courtès |
2022-01-10 | style: Add '--styling' option....* guix/scripts/style.scm (format-package-definition): New procedure.
(%options, show-help): Add "--styling".
(%default-options): Add 'styling-procedure'.
(guix-style): Honor it.
* tests/style.scm (with-test-package)
("input labels, 'safe' policy")
("input labels, 'safe' policy, nothing changed")
("input labels, margin comment")
("input labels, margin comment on long list")
("input labels, line comment")
("input labels, modify-inputs and margin comment"): Pass "-S inputs".
* etc/indent-code.el: Remove.
* doc/contributing.texi (Formatting Code): Mention "guix style" instead
of "etc/indent-code.el".
(Submitting Patches): Add item for "guix style".
* doc/guix.texi (Invoking guix style): Document "-S" and update.
| Ludovic Courtès |
2022-01-10 | style: Add support for "newline forms"....This allows us to express cases where a newline should be inserted
immediately after the head symbol of a list.
* guix/scripts/style.scm (%newline-forms): New variable.
(newline-form?): New procedure.
(pretty-print-with-comments): Handle "newline forms".
* tests/style.scm: Add test.
| Ludovic Courtès |
2022-01-10 | 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.
| Ludovic Courtès |
2022-01-10 | style: Improve pretty printer and add tests....* guix/scripts/style.scm (vhashq): New macro.
(%special-forms): New variable.
(special-form?): New procedure.
(pretty-print-with-comments): Add many clauses and tweak existing
rules.
* tests/style.scm (test-pretty-print): New macro.
<top level>: Add 'test-pretty-print' tests.
| Ludovic Courtès |
2021-12-18 | style: Gracefully handle errors such as EACCES when opening files....* guix/scripts/style.scm (guix-style): Wrap body in
'with-error-handling'.
| Ludovic Courtès |
2021-12-18 | style: Refer to source files by absolute file names....Previously, "guix style PACKAGE" would end up modifying a file looked up
under the current directory since the location associated with PACKAGE
is usually a relative file name.
* guix/scripts/style.scm (absolute-location): New procedure.
(simplify-package-inputs): Use it.
| Ludovic Courtès |
2021-11-23 | style: Add '--dry-run'....* guix/scripts/style.scm (edit-expression/dry-run): New procedure.
(simplify-package-inputs): Add #:edit-expression parameter.
(%options, show-help): Add '--dry-run'.
(guix-style): Honor '--dry-run'.
| Ludovic Courtès |
2021-09-30 | style: Really honor '--input-simplification=always'....* guix/scripts/style.scm (simplify-package-inputs): Use (const #t) when
POLICY is 'always.
| Ludovic Courtès |
2021-07-11 | Add 'guix style'....* guix/scripts/style.scm, tests/style.scm: New files.
* Makefile.am (MODULES, SCM_TESTS): Add them.
* po/guix/POTFILES.in: Add 'guix/scripts/style.scm'.
* doc/guix.texi (Invoking guix style): New node.
(package Reference): Reference it.
(Invoking guix lint): Likewise.
| Ludovic Courtès |