unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download
@ 2022-03-09  9:57 Ludovic Courtès
  2022-03-09 10:12 ` [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built" Ludovic Courtès
  2022-03-18 15:10 ` bug#54307: " Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Ludovic Courtès @ 2022-03-09  9:57 UTC (permalink / raw)
  To: 54307; +Cc: Ludovic Courtès, Julien Lepiller, Maxim Cournoyer

Hello Guix!

These patches color headings in the output of ‘show-what-to-build’:

  The following derivations will be built:

is now printed in bold magenta, and:

  X MB will be downloaded:

is printed in bold (this message is only visible at ‘-v2’.)

The reason it wasn’t done before is that it invalidates translations.
I think now is a good time as we prepare a release.

Julien, Maxim: WDYT?

Ludo’.

Ludovic Courtès (2):
  ui: 'show-what-to-build' highlights "The following [...] will be
    built".
  ui: 'show-what-to-build' highlights "would be downloaded" headings.

 guix/colors.scm |  4 +-
 guix/ui.scm     | 98 +++++++++++++++++++++++++++++--------------------
 2 files changed, 61 insertions(+), 41 deletions(-)


base-commit: 0d14f8a8702ec8016ac58e5778a754b3105ef418
-- 
2.34.0





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built".
  2022-03-09  9:57 [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download Ludovic Courtès
@ 2022-03-09 10:12 ` Ludovic Courtès
  2022-03-09 10:12   ` [bug#54307] [PATCH 2/2] ui: 'show-what-to-build' highlights "would be downloaded" headings Ludovic Courtès
  2022-03-09 10:52   ` [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built" Liliana Marie Prikler
  2022-03-18 15:10 ` bug#54307: " Ludovic Courtès
  1 sibling, 2 replies; 8+ messages in thread
From: Ludovic Courtès @ 2022-03-09 10:12 UTC (permalink / raw)
  To: 54307; +Cc: Ludovic Courtès

* guix/colors.scm (highlight/warn): New procedure.
* guix/ui.scm (show-what-to-build): Use 'highlight/warn' when displaying
what would/will be built.
---
 guix/colors.scm |  4 +++-
 guix/ui.scm     | 24 ++++++++++++++----------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/guix/colors.scm b/guix/colors.scm
index 3031f54799..ae0a583d94 100644
--- a/guix/colors.scm
+++ b/guix/colors.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2013, 2014 Free Software Foundation, Inc.
 ;;; Copyright © 2018 Sahithi Yarlagadda <sahi@swecha.net>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017, 2018, 2019, 2022 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +31,7 @@ (define-module (guix colors)
 
             colorize-string
             highlight
+            highlight/warn
             dim
 
             color-rules
@@ -143,6 +144,7 @@ (define (coloring-procedure color)
         str)))
 
 (define highlight (coloring-procedure (color BOLD)))
+(define highlight/warn (coloring-procedure (color BOLD MAGENTA)))
 (define dim (coloring-procedure (color DARK)))
 
 (define (colorize-matches rules)
diff --git a/guix/ui.scm b/guix/ui.scm
index 238952723e..8e4e3e2dfc 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1031,12 +1031,14 @@ (define display-download-size?
     ;; Unfortunately, this is hardly avoidable for proper i18n.
     (if dry-run?
         (begin
-          (unless (zero? verbosity)
+          (unless (or (zero? verbosity) (null? build))
             (format (current-error-port)
-                    (N_ "~:[The following derivation would be built:~%~{   ~a~%~}~;~]"
-                        "~:[The following derivations would be built:~%~{   ~a~%~}~;~]"
-                        (length build))
-                    (null? build) (map colorized-store-item build)))
+                    (highlight/warn
+                     (N_ "The following derivation would be built:~%"
+                         "The following derivations would be built:~%"
+                         (length build))))
+            (format (current-error-port) "~{  ~a~%~}"
+                    (map colorized-store-item build)))
           (cond ((>= verbosity 2)
                  (if display-download-size?
                      (format (current-error-port)
@@ -1082,12 +1084,14 @@ (define display-download-size?
                              (null? download) (length download))))))
 
         (begin
-          (unless (zero? verbosity)
+          (unless (or (zero? verbosity) (null? build))
             (format (current-error-port)
-                    (N_ "~:[The following derivation will be built:~%~{   ~a~%~}~;~]"
-                        "~:[The following derivations will be built:~%~{   ~a~%~}~;~]"
-                        (length build))
-                    (null? build) (map colorized-store-item build)))
+                    (highlight/warn
+                     (N_ "The following derivation will be built:~%"
+                         "The following derivations will be built:~%"
+                         (length build))))
+            (format (current-error-port) "~{  ~a~%~}"
+                    (map colorized-store-item build)))
           (cond ((>= verbosity 2)
                  (if display-download-size?
                      (format (current-error-port)
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#54307] [PATCH 2/2] ui: 'show-what-to-build' highlights "would be downloaded" headings.
  2022-03-09 10:12 ` [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built" Ludovic Courtès
@ 2022-03-09 10:12   ` Ludovic Courtès
  2022-03-09 10:52   ` [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built" Liliana Marie Prikler
  1 sibling, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2022-03-09 10:12 UTC (permalink / raw)
  To: 54307; +Cc: Ludovic Courtès

* guix/ui.scm (show-what-to-build): Highlight "X MB would be downloaded".
---
 guix/ui.scm | 74 +++++++++++++++++++++++++++++++----------------------
 1 file changed, 44 insertions(+), 30 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 8e4e3e2dfc..6c194eb3c9 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1041,21 +1041,28 @@ (define display-download-size?
                     (map colorized-store-item build)))
           (cond ((>= verbosity 2)
                  (if display-download-size?
-                     (format (current-error-port)
-                             ;; TRANSLATORS: "MB" is for "megabyte"; it should be
-                             ;; translated to the corresponding abbreviation.
-                             (G_ "~:[~,1h MB would be downloaded:~%~{   ~a~%~}~;~]")
-                             (null? download)
-                             download-size
-                             (map (compose colorized-store-item substitutable-path)
-                                  download))
-                     (format (current-error-port)
-                             (N_ "~:[The following file would be downloaded:~%~{   ~a~%~}~;~]"
-                                 "~:[The following files would be downloaded:~%~{   ~a~%~}~;~]"
-                                 (length download))
-                             (null? download)
-                             (map (compose colorized-store-item substitutable-path)
-                                  download)))
+                     (begin
+                       (format (current-error-port)
+                               (highlight
+                                ;; TRANSLATORS: "MB" is for "megabyte"; it
+                                ;; should be translated to the corresponding
+                                ;; abbreviation.
+                                (G_ "~:[~,1h MB would be downloaded:~%~;~]"))
+                               (null? download)
+                               download-size)
+                       (format (current-error-port) "~{  ~a~%~}"
+                               (map (compose colorized-store-item substitutable-path)
+                                    download)))
+                     (begin
+                       (format (current-error-port)
+                               (highlight
+                                (N_ "~:[The following file would be downloaded:~%~;~]"
+                                    "~:[The following files would be downloaded:~%~;~]"
+                                    (length download)))
+                               (null? download))
+                       (format (current-error-port) "~{  ~a~%~}"
+                               (map (compose colorized-store-item substitutable-path)
+                                    download))))
                  (format (current-error-port)
                          (N_ "~:[The following graft would be made:~%~{   ~a~%~}~;~]"
                              "~:[The following grafts would be made:~%~{   ~a~%~}~;~]"
@@ -1094,21 +1101,28 @@ (define display-download-size?
                     (map colorized-store-item build)))
           (cond ((>= verbosity 2)
                  (if display-download-size?
-                     (format (current-error-port)
-                             ;; TRANSLATORS: "MB" is for "megabyte"; it should be
-                             ;; translated to the corresponding abbreviation.
-                             (G_ "~:[~,1h MB will be downloaded:~%~{   ~a~%~}~;~]")
-                             (null? download)
-                             download-size
-                             (map (compose colorized-store-item substitutable-path)
-                                  download))
-                     (format (current-error-port)
-                             (N_ "~:[The following file will be downloaded:~%~{   ~a~%~}~;~]"
-                                 "~:[The following files will be downloaded:~%~{   ~a~%~}~;~]"
-                                 (length download))
-                             (null? download)
-                             (map (compose colorized-store-item substitutable-path)
-                                  download)))
+                     (begin
+                       (format (current-error-port)
+                               (highlight
+                                ;; TRANSLATORS: "MB" is for "megabyte"; it
+                                ;; should be translated to the corresponding
+                                ;; abbreviation.
+                                (G_ "~:[~,1h MB will be downloaded:~%~;~]"))
+                               (null? download)
+                               download-size)
+                       (format (current-error-port) "~{  ~a~%~}"
+                               (map (compose colorized-store-item substitutable-path)
+                                    download)))
+                     (begin
+                       (format (current-error-port)
+                               (highlight
+                                (N_ "~:[The following file will be downloaded:~%~;~]"
+                                    "~:[The following files will be downloaded:~%~;~]"
+                                    (length download)))
+                               (null? download))
+                       (format (current-error-port) "~{  ~a~%~}"
+                               (map (compose colorized-store-item substitutable-path)
+                                    download))))
                  (format (current-error-port)
                          (N_ "~:[The following graft will be made:~%~{   ~a~%~}~;~]"
                              "~:[The following grafts will be made:~%~{   ~a~%~}~;~]"
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built".
  2022-03-09 10:12 ` [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built" Ludovic Courtès
  2022-03-09 10:12   ` [bug#54307] [PATCH 2/2] ui: 'show-what-to-build' highlights "would be downloaded" headings Ludovic Courtès
@ 2022-03-09 10:52   ` Liliana Marie Prikler
  2022-03-10 10:19     ` [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download Ludovic Courtès
  1 sibling, 1 reply; 8+ messages in thread
From: Liliana Marie Prikler @ 2022-03-09 10:52 UTC (permalink / raw)
  To: Ludovic Courtès, 54307

Am Mittwoch, dem 09.03.2022 um 11:12 +0100 schrieb Ludovic Courtès:
> * guix/colors.scm (highlight/warn): New procedure.
> * guix/ui.scm (show-what-to-build): Use 'highlight/warn' when
> displaying
> what would/will be built.
highlight/warn sounds somewhat misleading for this use-case.  Should
this be highlight/info instead?




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download
  2022-03-09 10:52   ` [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built" Liliana Marie Prikler
@ 2022-03-10 10:19     ` Ludovic Courtès
  2022-03-10 10:46       ` Liliana Marie Prikler
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2022-03-10 10:19 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54307

Hi,

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> skribis:

> Am Mittwoch, dem 09.03.2022 um 11:12 +0100 schrieb Ludovic Courtès:
>> * guix/colors.scm (highlight/warn): New procedure.
>> * guix/ui.scm (show-what-to-build): Use 'highlight/warn' when
>> displaying
>> what would/will be built.
> highlight/warn sounds somewhat misleading for this use-case.  Should
> this be highlight/info instead?

I agree “warn” is misleading, but I don’t find “info” any clearer.  :-)

Maybe ‘highlight-more’ or something?

Ludo’.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download
  2022-03-10 10:19     ` [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download Ludovic Courtès
@ 2022-03-10 10:46       ` Liliana Marie Prikler
  2022-03-13 22:00         ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Liliana Marie Prikler @ 2022-03-10 10:46 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 54307

Am Donnerstag, dem 10.03.2022 um 11:19 +0100 schrieb Ludovic Courtès:
> Hi,
> 
> Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> skribis:
> 
> > Am Mittwoch, dem 09.03.2022 um 11:12 +0100 schrieb Ludovic Courtès:
> > > * guix/colors.scm (highlight/warn): New procedure.
> > > * guix/ui.scm (show-what-to-build): Use 'highlight/warn' when
> > > displaying
> > > what would/will be built.
> > highlight/warn sounds somewhat misleading for this use-case. 
> > Should
> > this be highlight/info instead?
> 
> I agree “warn” is misleading, but I don’t find “info” any clearer. 
> :-)
> 
> Maybe ‘highlight-more’ or something?
Highlight more than what?  Looking at (guix diagnostics) we currently
have merely bold for info, bold magenta for warning and bold red for
error.  On a related note, (guix diagnostics) appears a little over-
engineered; it's mostly there to highlight the diagnostic prefix, but
it would also highlight any other non-whitespace argument... is that
really useful?

Anyway, I would suggest using a less "offensive" colour to indicate how
much is being downloaded/built.  Using red or magenta in this case
would signal an error when that's actually the expected behaviour.  My
personal colouring bias would tend towards cyan or green here, although
green itself is already used to signal success and might not be a good
idea either.

While highlight/info on its own really doesn't make sense, it'd make
more sense if we also defined %warning-color, %info-color, %error-color
in colors and simply used them in diagnostics rather than the other way
round and also defined highlight/warning and highlight/error to
complete the pattern.  Once we figure out what we want to do with the
diagnostics, we could even drop them from the exports if the coloring
procedures can be used in their stead.

Cheers




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download
  2022-03-10 10:46       ` Liliana Marie Prikler
@ 2022-03-13 22:00         ` Ludovic Courtès
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2022-03-13 22:00 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 54307

Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> skribis:

> Am Donnerstag, dem 10.03.2022 um 11:19 +0100 schrieb Ludovic Courtès:
>> Hi,
>> 
>> Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> skribis:
>> 
>> > Am Mittwoch, dem 09.03.2022 um 11:12 +0100 schrieb Ludovic Courtès:
>> > > * guix/colors.scm (highlight/warn): New procedure.
>> > > * guix/ui.scm (show-what-to-build): Use 'highlight/warn' when
>> > > displaying
>> > > what would/will be built.
>> > highlight/warn sounds somewhat misleading for this use-case. 
>> > Should
>> > this be highlight/info instead?
>> 
>> I agree “warn” is misleading, but I don’t find “info” any clearer. 
>> :-)
>> 
>> Maybe ‘highlight-more’ or something?
> Highlight more than what?

More than just bold; the goal is to make “The following derivations will
be built” more prominent.

[...]

> Anyway, I would suggest using a less "offensive" colour to indicate how
> much is being downloaded/built.

What’s downloaded is still being displayed as bold with the default
color (black or white).  The only thing that changes colors is the
sentence above.

Thing is we have few colors at hand (see (guix colors)) and we need one
that works well both with a white and with a dark background.  So…

So far magenta is used for warnings, which is consistent with the intent
here.

WDYT?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#54307: [PATCH 0/2] Highlight headings showing what to build/download
  2022-03-09  9:57 [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download Ludovic Courtès
  2022-03-09 10:12 ` [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built" Ludovic Courtès
@ 2022-03-18 15:10 ` Ludovic Courtès
  1 sibling, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2022-03-18 15:10 UTC (permalink / raw)
  To: 54307-done; +Cc: Julien Lepiller, Maxim Cournoyer

Hi!

Ludovic Courtès <ludo@gnu.org> skribis:

>   ui: 'show-what-to-build' highlights "The following [...] will be
>     built".
>   ui: 'show-what-to-build' highlights "would be downloaded" headings.

I went ahead and pushed these as
625fa3cfe8c57cd5624608d2478c8c6be4c69c3b.

Of course we can still discuss color and name choices :-).  The
important part for me was to put the base in place so translations can
be updated before the release.

Ludo’.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-18 15:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-09  9:57 [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download Ludovic Courtès
2022-03-09 10:12 ` [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built" Ludovic Courtès
2022-03-09 10:12   ` [bug#54307] [PATCH 2/2] ui: 'show-what-to-build' highlights "would be downloaded" headings Ludovic Courtès
2022-03-09 10:52   ` [bug#54307] [PATCH 1/2] ui: 'show-what-to-build' highlights "The following [...] will be built" Liliana Marie Prikler
2022-03-10 10:19     ` [bug#54307] [PATCH 0/2] Highlight headings showing what to build/download Ludovic Courtès
2022-03-10 10:46       ` Liliana Marie Prikler
2022-03-13 22:00         ` Ludovic Courtès
2022-03-18 15:10 ` bug#54307: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).