Message ID | 20220309101234.24236-1-ludo@gnu.org |
---|---|
State | Accepted |
Headers | show |
Series | Highlight headings showing what to build/download | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
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?
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’.
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
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’.
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)