[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/05: squash! Add 'guix style'.
From: |
guix-commits |
Subject: |
04/05: squash! Add 'guix style'. |
Date: |
Sun, 27 Jun 2021 16:47:16 -0400 (EDT) |
civodul pushed a commit to branch wip-simplified-packages
in repository guix.
commit 051210822e888be23fa3902bc12eff8f7980fa9e
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Jun 27 17:33:03 2021 +0200
squash! Add 'guix style'.
Better handle line comments that follow margin comments.
---
guix/scripts/style.scm | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm
index 3e906ce..14b4439d 100644
--- a/guix/scripts/style.scm
+++ b/guix/scripts/style.scm
@@ -76,8 +76,11 @@
((memv chr '(#\( #\[))
(let/ec return
(let liip ((lst '()))
- (liip (cons (loop #f (lambda ()
- (return (reverse lst))))
+ (liip (cons (loop (match lst
+ (((? comment?) . _) #t)
+ (_ #f))
+ (lambda ()
+ (return (reverse lst))))
lst)))))
((memv chr '(#\) #\]))
(return))
@@ -122,8 +125,11 @@
(display " " port)
(display (comment->string comment) port))
(begin
- (newline port)
- (display (make-string indent #\space) port)
+ ;; When already at the beginning of a line, for example because
+ ;; COMMENT follows a margin comment, no need to emit a newline.
+ (unless (= column indent)
+ (newline port)
+ (display (make-string indent #\space) port))
(display (comment->string comment) port)))
(display (make-string indent #\space) port)
indent)