unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: Sahitihi <sahi@swecha.net>
Cc: guix-devel@gnu.org
Subject: Re: Patch file for colorize module
Date: Sat, 26 May 2018 16:16:02 +0200	[thread overview]
Message-ID: <878t864i59.fsf@elephly.net> (raw)
In-Reply-To: <3d5eca09-7730-bd38-265b-7942d0ea16ed@swecha.net>


Hi Sahithi,

> Please find the attachment. Hope I made it correct this time. :)

Thanks, this looks a lot better.  Some comments below:

> From 1bd9eaca576e7d958062197b9931d64c0882484e Mon Sep 17 00:00:00 2001
> From: root <root@localhost.localdomain>

This indicates that you’re doing development as the root user.  It’s
better to use a regular user and only switch to the root user when
absolutely needed.  For work on Guix you will not need to do anything as
the root user.

Also, you can tell git to use your name and email address by running
these commands:

    git config --global user.name "Sahithi Yarlagadda"
    git config --global user.email "sahi@swecha.net"

Any commits you make after that will be properly attributed to you.

> Date: Sat, 26 May 2018 17:34:23 +0530
> Subject: [PATCH] Added Colorize module and Copyrights line to ui

As you can see in the git history of the repository we use a peculiar
convention for describing the changes.  For this patch it would be
something like this:

--8<---------------cut here---------------start------------->8---
ui: Add support for colorization.

* guix/ui.scm (ansi-color-tables): New variable.
(color, colorize-string): New procedures.
--8<---------------cut here---------------end--------------->8---

> diff --git a/guix/ui.scm b/guix/ui.scm
> index 8d351607d..20fbf761f 100755
> --- a/guix/ui.scm
> +++ b/guix/ui.scm
> @@ -9,7 +9,9 @@
>  ;;; Copyright © 2015, 2016 Mathieu Lirzin <mthl@gnu.org>
>  ;;; Copyright © 2016 Roel Janssen <roel@gnu.org>
>  ;;; Copyright © 2016 Benz Schenk <benz.schenk@uzh.ch>
> -;;;
> +;;; Copyright © 2013,2014 Free Software Foundation, Inc.

Please add a space after the comma.

> @@ -106,7 +108,9 @@
>              guix-warning-port
>              warning
>              info
> -            guix-main))
> +            guix-main
> +            color
> +            colorize-string))

Do we really need to export the “color” procedure or is it enough to
export “colorize-string”?  Do we even need to export “colorize-string”
at all or should we only export the soft port that applies colours to
some strings?

> @@ -1578,4 +1582,49 @@ and signal handling has already been set up."
>    (initialize-guix)
>    (apply run-guix args))
>
> +(define ansi-color-tables

I think that “ansi-color-tables” could be renamed to “color-table”.

> +(define (color . lst)

For every procedure we need to have a short docstring that describes the
desired behaviour in a complete sentence or two.  Could you provide a
short description of the “color” procedure?  What does it do to its
variable argument list “LST”?

> +(define (colorize-string str . color-list)

The same applies here.

I’d be happy if you could make these changes quickly and send an updated
patch.  Once I receive it I’ll push it to a branch “wip-sahithi” in the
repository.

Thanks in advance!

- - - - - - -

We’re still lacking code to actually use “colorize-string” anywhere.
Could you please prepare a patch or a series of patches that achieves
the following:

* add a soft port to (guix ui) that colorizes strings that match an
  internal list of regular expressions.  The initial list of regular
  expressions could be something like this:

  '("^starting phase.*"
    "^phase .* succeeded.*"
    "^phase .* failed.*")

  See the documentation for “string-match” for details.

  Initially, the port should print any matching string as just green.
  All other strings should not be modified at all.  This will become a
  little fancier in the future to allow use to apply different colours
  or formatting to different parts of the strings just like it is done
  by “guix-build-log-minor-mode” of the Emacs interface for Guix.  (If
  you haven’t played with that interface yet, please do so.)

* change “guix-package” in “guix/scripts/package.scm” such that it will
  use the new soft port.  Note that “current-build-output-port” in (guix
  store) is a so-called parameter, which can be modified dynamically
  using “parameterize”.  Take a look at “guix/scripts/build.scm” where
  “current-build-output-port” is parameterized to the void port when
  “--quiet” was passed (this causes “guix build” to print no build log).
  The change to “guix-package” should be very similar.

Does this sound like a good idea to you?

By using a soft port I think we can limit future work (e.g. hiding of
parts of the build output) to just the inner procedures and data
structures of the soft port.

Please try to give us short updates every two days or so; this way we
can ensure that any questions you may have can be addressed quickly.
Please also ask right away when anything is unclear or if the suggested
approach seems weird.

--
Ricardo

  reply	other threads:[~2018-05-26 14:17 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8ea5d026-fab9-7b12-198e-610ad7743cb2@swecha.net>
     [not found] ` <871sfxev9w.fsf@elephly.net>
     [not found]   ` <7626275c-3eee-bb05-ab9d-4c88ec6f0329@swecha.net>
     [not found]     ` <87r2nvjte6.fsf@elephly.net>
     [not found]       ` <5ab51417-b635-9725-9f48-3bc3f9b61fdf@swecha.net>
     [not found]         ` <87tvsko2wd.fsf@elephly.net>
     [not found]           ` <7290013c-990d-3f7d-d8db-38e090ed766a@swecha.net>
     [not found]             ` <87zi28kt82.fsf@elephly.net>
     [not found]               ` <8573e97d-d107-cde6-cd17-35f4ef6d2de3@swecha.net>
     [not found]                 ` <87k1takumm.fsf@elephly.net>
     [not found]                   ` <87o9hycwl6.fsf@elephly.net>
2018-05-11 21:16                     ` Status of Submitted Patches Sahithi Yarlagadda
2018-05-11 22:21                       ` Ricardo Wurmus
2018-05-12  7:50                         ` Ricardo Wurmus
2018-05-15 17:41                         ` Sahitihi
2018-05-20  9:40                           ` Ricardo Wurmus
2018-05-20 10:47                             ` Gábor Boskovits
2018-05-20 13:46                               ` Ricardo Wurmus
2018-05-23  7:53                             ` Sahitihi
2018-05-23  8:21                               ` Ricardo Wurmus
2018-05-24 17:16                                 ` Sahitihi
2018-05-24 20:00                                   ` Ricardo Wurmus
2018-05-25  3:43                                 ` Sahitihi
2018-05-25  5:18                                   ` Ricardo Wurmus
2018-05-25 17:59                                     ` Patch file for colorize module Sahitihi
2018-05-26  6:06                                       ` Sahitihi
2018-05-26  9:35                                         ` Ricardo Wurmus
2018-05-26 12:06                                           ` Sahitihi
2018-05-26 14:16                                             ` Ricardo Wurmus [this message]
2018-05-26 18:22                                               ` Sahitihi
2018-05-26 18:38                                                 ` Sahitihi
2018-05-26 21:20                                                   ` Ricardo Wurmus
2018-05-27 15:49                                                     ` Gábor Boskovits
2018-05-31  6:26                                               ` Fwd: " Ricardo Wurmus
2018-05-31 18:25                                                 ` Sahitihi
2018-05-31 19:28                                                   ` Ricardo Wurmus
2018-06-02 15:01                                                     ` Ricardo Wurmus
2018-06-03 14:18                                                     ` Sahitihi
2018-06-03 19:30                                                       ` Ricardo Wurmus
2018-06-04  7:48                                                         ` Sahitihi
2018-06-04 10:03                                                           ` Ricardo Wurmus
2018-06-04 18:51                                                             ` Sahitihi
2018-06-05 19:44                                                               ` Ricardo Wurmus
2018-06-06 19:49                                                                 ` Sahitihi
2018-06-06 20:06                                                                   ` Ricardo Wurmus
2018-06-06 21:20                                                                     ` Sahitihi
2018-06-06 21:28                                                                       ` Ricardo Wurmus
2018-06-07  3:29                                                                         ` Sahitihi
2018-06-07  5:22                                                                           ` Ricardo Wurmus
2018-06-07  7:47                                                                             ` Sahitihi
2018-06-07  8:25                                                                               ` Ricardo Wurmus
2018-06-08 17:01                                                                                 ` Sahitihi
2018-06-09  0:57                                                                                   ` Ricardo Wurmus
2018-06-09 18:08                                                                                     ` Sahitihi
2018-06-09 20:57                                                                                       ` Ricardo Wurmus
2018-06-11 12:14                                                                                         ` Sahitihi
2018-06-11 12:28                                                                                           ` Gábor Boskovits
2018-06-11 16:21                                                                                             ` Sahitihi
2018-06-12 14:12                                                                                               ` Ricardo Wurmus
2018-06-12 21:06                                                                                                 ` Sahitihi
2018-06-12 22:12                                                                                                   ` Ricardo Wurmus
2018-06-13 16:08                                                                                                     ` Sahithi Yarlagadda
2018-06-13 19:15                                                                                                       ` Ricardo Wurmus
2018-06-15 20:16                                                                                                         ` Sahitihi
2018-06-15 21:47                                                                                                           ` Next steps Ricardo Wurmus
2018-06-16 14:55                                                                                                             ` Sahitihi
2018-06-21 11:05                                                                                                               ` Ricardo Wurmus
2018-06-21 16:54                                                                                                                 ` Sahithi Yarlagadda
2018-06-25 20:13                                                                                                                   ` Sahithi Yarlagadda
2018-06-25 20:28                                                                                                                     ` Ricardo Wurmus
2018-06-26 20:01                                                                                                                       ` Gábor Boskovits
2018-06-29 22:51                                                                                                                       ` Sahithi Yarlagadda
2018-07-03  2:29                                                                                                                         ` Sahithi Yarlagadda
2018-06-24 18:25                                                                                                             ` Sahithi Yarlagadda
2018-06-24 20:22                                                                                                               ` Ricardo Wurmus
2018-06-24 20:33                                                                                                                 ` Sahithi Yarlagadda
2018-06-11 12:37                                                                                           ` Fwd: Re: Patch file for colorize module Ricardo Wurmus
2018-06-11 16:31                                                                                             ` Sahitihi
2018-06-04 11:41                                                         ` Ludovic Courtès

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878t864i59.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=guix-devel@gnu.org \
    --cc=sahi@swecha.net \
    /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 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).