From: Ricardo Wurmus <rekado@elephly.net>
To: zimoun <zimon.toutoune@gmail.com>
Cc: 55615-done@debbugs.gnu.org
Subject: [bug#55615] [PATCH] gnu: Add r-pscbs.
Date: Fri, 27 May 2022 10:12:51 +0200 [thread overview]
Message-ID: <87zgj3cs09.fsf@elephly.net> (raw)
In-Reply-To: <CAJ3okZ2a=_hbzvZTkdMZ9PK_pXgis8NTvg1P4dXrCKS=1bth1w@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 600 bytes --]
zimoun <zimon.toutoune@gmail.com> writes:
> Hi,
>
> On Tue, 24 May 2022 at 23:30, Ricardo Wurmus <rekado@elephly.net> wrote:
>
>> Applied with formatting changes. Thanks!
>
> Indeed, sorry. I reformatted the output of "guix import" but then I
> forgot to reformat again the phase modification (my bad!). And I ran
> "guix lint" which reported nothing. But "guix style" reformats;
> which I do not use (yet).
>
> Well, it is many manual error-prone steps. My questions are :
>
> 1. Could we adapted "guix import cran" to output something using the
> format of "guix style"?
How about this:
[-- Attachment #2: 0001-scripts-import-Use-pretty-printer-from-guix-scripts-.patch --]
[-- Type: text/x-patch, Size: 3312 bytes --]
From a10afc4c60ce734941c3c080cf13ec6636f0be33 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Fri, 27 May 2022 10:07:26 +0200
Subject: [PATCH] scripts/import: Use pretty printer from (guix scripts style).
* guix/scripts/import.scm (guix-import): Use pretty-print-with-comments.
(newline-rewriting-port): Remove procedure.
---
guix/scripts/import.scm | 39 +++------------------------------------
1 file changed, 3 insertions(+), 36 deletions(-)
diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm
index fa79f3211e..62aa7bdbc5 100644
--- a/guix/scripts/import.scm
+++ b/guix/scripts/import.scm
@@ -2,7 +2,7 @@
;;; Copyright © 2012, 2013, 2014, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
-;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2019, 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
@@ -25,6 +25,7 @@
(define-module (guix scripts import)
#:use-module (guix ui)
#:use-module (guix scripts)
+ #:use-module (guix scripts style)
#:use-module (guix utils)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
@@ -32,41 +33,9 @@ (define-module (guix scripts import)
#:use-module (srfi srfi-37)
#:use-module (ice-9 format)
#:use-module (ice-9 match)
- #:use-module (ice-9 pretty-print)
#:export (%standard-import-options
guix-import))
-\f
-;;;
-;;; Helper.
-;;;
-
-(define (newline-rewriting-port output)
- "Return an output port that rewrites strings containing the \\n escape
-to an actual newline. This works around the behavior of `pretty-print'
-and `write', which output these as \\n instead of actual newlines,
-whereas we want the `description' field to contain actual newlines
-rather than \\n."
- (define (write-string str)
- (let loop ((chars (string->list str)))
- (match chars
- (()
- #t)
- ((#\\ #\n rest ...)
- (newline output)
- (loop rest))
- ((chr rest ...)
- (write-char chr output)
- (loop rest)))))
-
- (make-soft-port (vector (cut write-char <>)
- write-string
- (lambda _ #t) ; flush
- #f
- (lambda _ #t) ; close
- #f)
- "w"))
-
\f
;;;
;;; Command line options.
@@ -119,9 +88,7 @@ (define-command (guix-import . args)
((importer args ...)
(if (member importer importers)
(let ((print (lambda (expr)
- (pretty-print expr (newline-rewriting-port
- (current-output-port))
- #:max-expr-width 80))))
+ (pretty-print-with-comments (current-output-port) expr))))
(match (apply (resolve-importer importer) args)
((and expr (or ('package _ ...)
('let _ ...)
--
2.36.1
[-- Attachment #3: Type: text/plain, Size: 13 bytes --]
--
Ricardo
next prev parent reply other threads:[~2022-05-27 8:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-24 18:08 [bug#55615] [PATCH] gnu: Add r-pscbs zimoun
2022-05-24 21:29 ` bug#55615: " Ricardo Wurmus
2022-05-25 7:31 ` [bug#55615] " zimoun
2022-05-27 8:12 ` Ricardo Wurmus [this message]
2022-06-01 9:02 ` zimoun
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zgj3cs09.fsf@elephly.net \
--to=rekado@elephly.net \
--cc=55615-done@debbugs.gnu.org \
--cc=zimon.toutoune@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.