[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Colorized REPL

From: Nala Ginrut
Subject: Re: [PATCH] Colorized REPL
Date: Wed, 05 Dec 2012 16:48:36 +0800

On Wed, 2012-12-05 at 16:23 +0800, Daniel Hartwig wrote:
> On 5 December 2012 15:21, Nala Ginrut <address@hidden> wrote:
> > Hi folks!
> > Here's a patch to add colorized-REPL.
> Some comments :-)
> diff --git a/module/ice-9/colorized.scm b/module/ice-9/colorized.scm
> new file mode 100644
> index 0000000..fe42a9a
> --- /dev/null
> +++ b/module/ice-9/colorized.scm
> @@ -0,0 +1,290 @@
> +;;  Copyright (C) 2012
> +;;      "Mu Lei" known as "NalaGinrut" <address@hidden>
> +;;  Ragnarok is free software: you can redistribute it and/or modify
> +;;  it under the terms of the GNU General Public License as published by
> +;;  the Free Software Foundation, either version 3 of the License, or
> +;;  (at your option) any later version.
> Contributions to GNU must have the copyright assigned to FSF, no?

Oh~I'm very sorry! I just copied the header from one of my project!

> +  #:use-module (oop goops)
> This module seems only used to determine the type of each datum for
> assigning a colour:
> +(define *colorize-list*
> +  `((,<integer> ,color-integer light-blue)
> +    (,<char> ,color-char brown)
> The datums tested for are all primitives.  For reference, the
> “class-of” operator is more-or-less equivalent to:
>  (cond
>   ((integer? x) <interge>)
>   ((char? x) <char>)
> Is there some advantage to using the GOOPS classes rather than
> equivalent predicates, which are more universal?  Of course, the order
> of the tests matters highly in both cases.

GOOPS classes covered all the possible types in Guile, and it's easy to
detect the type of a datum with class-of. I just choose the simplest way
which I can imagined.

> There is already a guile-lib module (ansi term-color) that has a
> particular syntax and defines the codes.  It would be excellent to
> make use of it here, or at least share the syntax and avoid some
> duplication.

The code segment of the color is not so big, so I write my own. 
And it's not easy to do a quick hack with mixing other guy's code.
For a quick hack, and it's simple, so I have no time to care about
reusing other's work. I don't think it's proper to use (ansi term-color)
purposely, since it's not in Guile.

PS: A fixed patch attached.
> Regards

Attachment: 0002-ice-9-colorized-REPL-feature.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]