Wrong again. I forget add 'before-print-hook' and *unspecified* situation. Resend again. On Wed, 2012-12-05 at 16:48 +0800, Nala Ginrut wrote: > On Wed, 2012-12-05 at 16:23 +0800, Daniel Hartwig wrote: > > On 5 December 2012 15:21, Nala Ginrut 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" > > +;; 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* > > + `((, ,color-integer light-blue) > > + (, ,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) ) > > ((char? x) ) > > … > > > > 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 > > >